diff --git a/containers/ecr-viewer/seed-scripts/locustfile.py b/containers/ecr-viewer/seed-scripts/locustfile.py index b59097425..c5ff7ed7f 100644 --- a/containers/ecr-viewer/seed-scripts/locustfile.py +++ b/containers/ecr-viewer/seed-scripts/locustfile.py @@ -10,14 +10,17 @@ class EcrViewer(HttpUser): @task def ecr_viewer(self): + """get the ecr viewer library page""" self.client.get(f"/ecr-viewer") @task def orchestration(self): + """get the orchestration endpoint""" self.client.get(f"/orchestration") @task def upload_zip(self): + """upload a zip file to the orchestration endpoint""" for file in get_zipped_files(): with open(file, "rb") as opened_file: data = { @@ -30,14 +33,14 @@ def upload_zip(self): file_tuple = { "upload_file": ( file, opened_file.read(), "application/zip") } response = self.client.post(f"/orchestration/process-zip", data=data, files=file_tuple) self.tasks.append(check_ecr(self, file, response.json())) - - # Runs at the start of each test. Useful for authentication and setup actions. + def on_start(self): + """install the requirements""" subprocess.run(["pip", "install", "-r", "requirements.txt"]) pass -# Check the ecr viewer response for eicr_id and view the ecr def check_ecr(self, file, response): + """Check the ecr viewer response for eicr_id and view the ecr""" if "detail" in response: print(f"{file}", response['detail']) if "message" in response: @@ -57,8 +60,8 @@ def check_ecr(self, file, response): else: print("No eicr_id found in response") -# Get all the zipped files in the baseECR folder def get_zipped_files(): + """Get all the zipped files in the baseECR folder""" files = [] BASEDIR = os.path.dirname(os.path.abspath(__file__)) subfolders = ["LA"]