Skip to content

Commit 8637230

Browse files
nadove-ucschannes-ucsc
authored andcommitted
Use selected deployment for Locust test
1 parent 0f565a6 commit 8637230

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,13 +1100,14 @@ running it is straight-forward with your development environment set up.
11001100

11011101
If it is not installed, perform step 2.3 in this README.
11021102

1103-
2. To scale test the Azul web service on integration run
1103+
2. To scale test the Azul web service, run
11041104

11051105
```
11061106
locust -f scripts/locust/service.py
11071107
```
11081108

1109-
If you want to test against a different stage use the `--host` option:
1109+
By default, the tests will target the currently selected deployment.
1110+
If you want to test against a different deployment, use the `--host` option:
11101111

11111112
```
11121113
locust -f scripts/locust/service.py --host https://service.dev.explore.data.humancellatlas.org

scripts/locust/service.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
JSON,
3737
)
3838

39-
# This script simluates a user triggering Azul endpoints via the data browser GUI.
39+
# This script simluates a user triggering Azul endpoints via the data browser
40+
# GUI.
4041
# To run:
4142
# - `locust -f scripts/locust/service.py`
4243
# - in browser go to localhost:8089
@@ -65,7 +66,10 @@ def parallel_requests():
6566
group.join()
6667

6768

68-
def browse_page(client: HttpSession, index_name: str, filters: JSON, **extra_index_params):
69+
def browse_page(client: HttpSession,
70+
index_name: str,
71+
filters: JSON,
72+
**extra_index_params):
6973
filters = json.dumps(filters)
7074
with parallel_requests() as group:
7175
group.spawn(lambda: client.get(endpoint('/repository/summary',
@@ -94,7 +98,10 @@ def projects_start_page(self):
9498

9599
@task
96100
def filter_mtx_files(self):
97-
browse_page(self.client, 'projects', {"fileFormat": {"is": ["mtx"]}}, **browser_search_params)
101+
browse_page(self.client,
102+
'projects',
103+
{"fileFormat": {"is": ["mtx"]}},
104+
**browser_search_params)
98105

99106

100107
class ManifestTaskSet(SequentialTaskSet):
@@ -104,7 +111,11 @@ class ManifestTaskSet(SequentialTaskSet):
104111

105112
# Select islet of Langerhans since it's present in the develop deployment.
106113
organ_part_filter = {"organPart": {"is": ["islet of Langerhans"]}}
107-
manifest_file_format_filter = {"fileFormat": {"is": ["fastq.gz", "bai", "bam", "csv", "results", "txt"]}}
114+
manifest_file_format_filter = {
115+
"fileFormat": {
116+
"is": ["fastq.gz", "bai", "bam", "csv", "results", "txt"]
117+
}
118+
}
108119

109120
@task
110121
def start_page(self):
@@ -119,7 +130,8 @@ def filter_organ_part(self):
119130

120131
@task
121132
def download_manifest(self):
122-
self.client.get(endpoint('/repository/summary', filters=json.dumps(self.organ_part_filter)),
133+
self.client.get(endpoint('/repository/summary',
134+
filters=json.dumps(self.organ_part_filter)),
123135
name='/repository/summary')
124136
export_url = endpoint('/manifest/files',
125137
filters=json.dumps({**self.organ_part_filter,
@@ -129,7 +141,8 @@ def download_manifest(self):
129141
name='/manifest/files',
130142
catch_response=True,
131143
allow_redirects=False) as response:
132-
# This is necessary because non 2xx response are counted as failures unless specified like this
144+
# This is necessary because non 2xx response are counted as failures
145+
# unless specified like this
133146
if response.status_code == 301 or 200 <= response.status_code < 300:
134147
response.success()
135148
while response.status_code == 301:
@@ -201,7 +214,7 @@ def dos(self):
201214

202215

203216
class ServiceLocust(HttpUser):
204-
host = 'https://service.integration.explore.data.humancellatlas.org'
217+
host = config.service_endpoint()
205218
tasks = {
206219
MatrixTaskSet: 1,
207220
GA4GHTaskSet: 1,

0 commit comments

Comments
 (0)