Skip to content

Commit

Permalink
fix bugs according to reviews, add new versions, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
mrMosi committed Feb 26, 2025
1 parent 7e10d09 commit bda87a4
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 19 deletions.
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
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
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)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2022 Google LLC
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,12 +38,12 @@ readarray -t ALL_VERSIONS < "${SCRIPT_PATH}/versions.txt"

mkdir -p "${FINGERPRINTS_PATH}"

BINPROTO="${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/google/locust.binproto"
BINPROTO="${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/locust.binproto"

startLocust() {
local version="$1"
pushd "${APP_PATH}" >/dev/null
LC_VERSION="${version}" docker compose up -d
LC_VERSION="${version}" docker compose up -d --wait
popd >/dev/null
}

Expand All @@ -69,15 +69,12 @@ for LC_VERSION in "${ALL_VERSIONS[@]}"; do
echo "Fingerprinting Locust version ${LC_VERSION} ..."
# Start a live instance of Locust.
startLocust "${LC_VERSION}"
# Arbitrarily chosen so that Locust is up and running.
echo "Waiting for Locust ${LC_VERSION} to be ready ..."
sleep 30

# Checkout the repository to the correct tag.
checkOutRepo "${GIT_REPO}" "${LC_VERSION}"

updateFingerprint \
"Locust" \
"locust" \
"${LC_VERSION}" \
"${FINGERPRINTS_PATH}" \
"${GIT_REPO}" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
2.33.0
2.32.10
2.32.9
2.32.8
2.32.7
2.32.6
2.32.5
2.32.4
2.32.3
2.32.2
2.32.1
2.32.0
2.31.8
2.31.7
2.31.6
2.31.5
2.31.4
2.31.3
2.31.2
2.31.1
2.31.0
2.30.1
2.29.1
2.29.0
2.28.0
2.27.0
2.26.0
2.25.0
2.24.1
2.24.0
2.23.1
2.23.0
2.22.0
2.21.0
2.20.2
2.20.1
2.20.0
2.19.1
2.19.0
2.18.4
2.18.3
2.18.2
2.18.1
2.17.0
2.16.1
2.16.0
2.15.1
2.15.0
2.14.2
2.14.1
2.14.0
Expand Down Expand Up @@ -50,3 +98,35 @@
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.2
1.3.1
1.3.0
1.2.3
1.2.2
1.2.1
1.2
1.1.1
1.1
1.0.3
1.0.2
0.14.5
1.0.1
1.0
1.0b2
0.14.6
1.0b1
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.2
0.12.1

0 comments on commit bda87a4

Please sign in to comment.