-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bugs according to reviews, add new versions, ...
- Loading branch information
mrMosi
committed
Feb 26, 2025
1 parent
7e10d09
commit bda87a4
Showing
5 changed files
with
120 additions
and
19 deletions.
There are no files selected for viewing
16 changes: 6 additions & 10 deletions
16
google/fingerprinters/web/scripts/updater/community/locust/app/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
version: '3' | ||
|
||
services: | ||
master: | ||
image: "locustio/locust:${LC_VERSION}" | ||
ports: | ||
- "8089:8089" | ||
- "8089:8089" | ||
volumes: | ||
- ./:/mnt/locust | ||
- ./locustfile.py:/mnt/locust/locustfile.py | ||
command: -f /mnt/locust/locustfile.py --master -H http://master:8089 | ||
|
||
worker: | ||
image: "locustio/locust:${LC_VERSION}" | ||
volumes: | ||
- ./:/mnt/locust | ||
command: -f /mnt/locust/locustfile.py --worker --master-host master | ||
healthcheck: | ||
test: [ "CMD", "python3", "-c", "import socket; socket.create_connection(('localhost', 8089), timeout=1)" ] | ||
interval: 3s | ||
retries: 10 |
14 changes: 12 additions & 2 deletions
14
google/fingerprinters/web/scripts/updater/community/locust/app/locustfile.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
from locust import HttpUser, task | ||
try: | ||
from locust import HttpUser, TaskSet, task | ||
except ImportError: | ||
# For older versions of Locust | ||
from locust import HttpLocust as HttpUser, TaskSet, task | ||
|
||
class HelloWorldUser(HttpUser): | ||
|
||
class UserTasks(TaskSet): | ||
@task | ||
def hello_world(self): | ||
self.client.get("/hello") | ||
self.client.get("/world") | ||
|
||
|
||
class HelloWorldUser(HttpUser): | ||
host = "http://127.0.0.1:8089" | ||
task_set = UserTasks |
18 changes: 18 additions & 0 deletions
18
google/fingerprinters/web/scripts/updater/community/locust/getAllTags.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import requests | ||
|
||
|
||
def get_locust_tags(): | ||
url = "https://hub.docker.com/v2/repositories/locustio/locust/tags" | ||
tags = [] | ||
while url: | ||
response = requests.get(url) | ||
data = response.json() | ||
tags.extend([tag['name'] for tag in data['results']]) | ||
url = data['next'] | ||
return tags | ||
|
||
|
||
if __name__ == "__main__": | ||
tags = get_locust_tags() | ||
for tag in tags: | ||
print(tag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters