Fix test cases

Sometimes multiple jobs are spawned if the remote branch spec is **. In such cases we check for the results too early. Wait till the first build is complete and get the revision number for that build alone