On Mon, Jan 20, 2014 at 11:50 AM, Klaus Aehlig <[email protected]> wrote:
> > > +def TestJobCancellation(): > > + """gnt-job cancel""" > > + # The delay used for the first command should be large enough for the > next > > + # command and the cancellation command to complete before the first > job is > > + # done. The second delay should be small enough that not too much > time is > > + # spend waiting in the case of a failed cancel and a running command. > > + FIRST_COMMAND_DELAY = 3.0 > > 3 seconds might be a bit short, if there is, e.g., a bad network connection > while doing the qa. I'd suggest to increase it significantly to avoid the > flakyness of this test. > > Increased it to 10 seconds, should be fine for two job submission commands. I am reluctant to go any further as the QA takes too long as it is. > > + # Now first wait until all of the jobs could have been completed > > + time.sleep(FIRST_COMMAND_DELAY + SECOND_COMMAND_DELAY + 0.5) > > Please replace by a gnt-job wait, to no introduce even more races into > this qa test. > > In 2.8, there is watch and not wait, but sure, ACK. > Thanks, > Klaus > > -- > Klaus Aehlig > Google Germany GmbH, Dienerstr. 12, 80331 Muenchen > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg > Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores > Interdiff: diff --git a/qa/qa_job.py b/qa/qa_job.py index 91040ff..e784af4 100644 --- a/qa/qa_job.py +++ b/qa/qa_job.py @@ -67,7 +67,7 @@ def TestJobCancellation(): # command and the cancellation command to complete before the first job is # done. The second delay should be small enough that not too much time is # spend waiting in the case of a failed cancel and a running command. - FIRST_COMMAND_DELAY = 3.0 + FIRST_COMMAND_DELAY = 10.0 AssertCommand(["gnt-debug", "delay", "--submit", str(FIRST_COMMAND_DELAY)]) SECOND_COMMAND_DELAY = 1.0 @@ -86,8 +86,9 @@ def TestJobCancellation(): job_id = possible_job_ids[0] AssertCommand(["gnt-job", "cancel", job_id]) - # Now first wait until all of the jobs could have been completed - time.sleep(FIRST_COMMAND_DELAY + SECOND_COMMAND_DELAY + 0.5) + # Now wait until the second job finishes, and expect the watch to fail due to + # job cancellation + AssertCommand(["gnt-job", "watch", job_id], fail=True) # Then check for job cancellation status_dict = _GetJobStatuses()
