diff --git a/behaviour/features/squonk-basic-job-execution.feature b/behaviour/features/squonk-basic-job-execution.feature index f42dd21..5d98da3 100644 --- a/behaviour/features/squonk-basic-job-execution.feature +++ b/behaviour/features/squonk-basic-job-execution.feature @@ -89,7 +89,9 @@ Feature: Verify a fragalysis stack can run Squonk Jobs against public Targets And I can get the "Behaviour Snapshot" Snapshot ID And I can get the last JobFileTransfer SUB_PATH When I login - And I run fragmenstein-combine with the following variables + And I do a GET request at /api/compound-sets + And remember the count + And I run "fragmenstein-combine" from the "fragmenstein" collection with the following variables """ { "protein": "fragalysis-files/{SUB_PATH}/A71EV2A-x0152_A_201_1_A71EV2A-x3977+A+202+1_apo-desolv.pdb", @@ -107,10 +109,10 @@ Feature: Verify a fragalysis stack can run Squonk Jobs against public Targets """ Then the response should be ACCEPTED And the response should contain a JobRequest ID - And the JobRequest should have a job_status value of SUCCESS within 1 minute + And the JobRequest should have a job_status value of SUCCESS within 2 minutes And the JobRequest should have an upload_status value of SUCCESS within 20 seconds When I do a GET request at /api/compound-sets - Then the length of the list in the response should be 1 + Then the count must be one larger than the remembered count Scenario: Delete the last FileTransfer Given I can login diff --git a/behaviour/features/steps/api_utils.py b/behaviour/features/steps/api_utils.py index 6871fd0..d2def51 100644 --- a/behaviour/features/steps/api_utils.py +++ b/behaviour/features/steps/api_utils.py @@ -1,4 +1,5 @@ -"""A collection of functions to simplify access to the stack's API, +""" +A collection of functions to simplify access to the stack's REST API, used primarily to reduce the number of lines in the step file. """ @@ -151,7 +152,7 @@ def initiate_job_request( """Runs a Job in Squonk.""" # Convert the Job specification to a string - # and then replace all the occurences of `{SUB_PATH}` with the job_sub_path + # and then replace all the occurrences of `{SUB_PATH}` with the job_sub_path job_spec_str = json.dumps(job_spec) job_spec_str = job_spec_str.replace("{SUB_PATH}", job_sub_path) diff --git a/behaviour/features/steps/awx_utils.py b/behaviour/features/steps/awx_utils.py index ac97711..4639bc3 100644 --- a/behaviour/features/steps/awx_utils.py +++ b/behaviour/features/steps/awx_utils.py @@ -1,4 +1,7 @@ -"""AWX utilities for steps.""" +""" +AWX utilities for steps. +Logic that allows us to run AWX Job Templates (to wipe and create stacks). +""" import os import shlex diff --git a/behaviour/features/steps/config.py b/behaviour/features/steps/config.py index d954fd1..97e1df4 100644 --- a/behaviour/features/steps/config.py +++ b/behaviour/features/steps/config.py @@ -1,4 +1,5 @@ -"""Common config for the behaviour test steps. +""" +Common config for the behaviour test steps. Essentially all the environment variables we need to run the tests. """ diff --git a/behaviour/features/steps/steps.py b/behaviour/features/steps/steps.py index 4c1956b..f21f2a5 100644 --- a/behaviour/features/steps/steps.py +++ b/behaviour/features/steps/steps.py @@ -354,8 +354,10 @@ def i_delete_the_job_file_transfer(context) -> None: context.status_code = resp.status_code -@when("I run {job_name} with the following variables") # pylint: disable=not-callable -def i_run_x_with_the_following_variables(context, job_name) -> None: +@when( # pylint: disable=not-callable + 'I run "{job_name}" from the "{collection_name}" collection with the following variables' +) +def i_run_x_with_the_following_variables(context, job_name, collection_name) -> None: """Run a given Job replacing each occurrence of {SUB_PATH} in the Job specification with the sub-path used by the file transfer logic. It relies on context members: - - stack_name @@ -383,7 +385,7 @@ def i_run_x_with_the_following_variables(context, job_name) -> None: assert context.text is not None variables: Dict[str, Any] = ast.literal_eval(context.text) spec = { - "collection": "fragmenstein", + "collection": collection_name, "job": job_name, "version": "1.0.0", "variables": variables, @@ -427,6 +429,33 @@ def the_landing_page_response_should_be_x(context, status_code_name) -> None: assert resp.status_code == expected_code +@when("remember the count") # pylint: disable=not-callable +def remember_the_count(context) -> None: + """Relies on context members: - + - response_count + Sets the following context members: - + - remembered_response_count + """ + assert context.failed is False + assert hasattr(context, "response_count") + + context.remembered_response_count = context.response_count + + +@then( + "the count must be one larger than the remembered count" +) # pylint: disable=not-callable +def the_count_must_be_one_larger_than_the_remembered_count(context) -> None: + """Relies on the context members: - + - response_count + - remembered_response_count""" + assert context.failed is False + assert hasattr(context, "response_count") + assert hasattr(context, "remembered_response_count") + + assert context.response_count == context.remembered_response_count + 1 + + @then( # pylint: disable=not-callable "the length of the list in the response should be {count:d}" )