Skip to content

Locustfile Detection Logic BrokenΒ #256

@pwrmiller

Description

@pwrmiller

Describe the bug

Locust test reporting always picks the first found Python file, not locustfile.py due to broken logic.

Bug

Logs:

2025-10-16T18:44:43.997Z Archive: mIiFQHRMqs.zip
2025-10-16T18:44:43.997Z inflating: package.py
2025-10-16T18:44:43.997Z inflating: config.py	
2025-10-16T18:44:43.997Z inflating: locustfile.py
2025-10-16T18:44:43.998Z inflating: generate_config.py
2025-10-16T18:44:43.998Z inflating: README.md
2025-10-16T18:44:43.998Z inflating: templates/config.py.j2
2025-10-16T18:44:43.998Z UNZIPPED
2025-10-16T18:44:44.002Z total 56
2025-10-16T18:44:44.002Z -rw-r--r-- 1 root root 125 Oct 15 09:47 README.md
2025-10-16T18:44:44.002Z -rw-r--r-- 1 root root 224 Oct 16 14:40 config.py
2025-10-16T18:44:44.002Z -rwxr-xr-x 1 root root 1270 Sep 19 21:12 ecscontroller.py
2025-10-16T18:44:44.002Z -rwxr-xr-x 1 root root 2079 Sep 19 21:12 ecslistener.py
2025-10-16T18:44:44.002Z -rw-r--r-- 1 root root 1810 Oct 16 14:40 generate_config.py
2025-10-16T18:44:44.002Z -rwxr-xr-x 1 root root 6521 Sep 19 21:12 jar_updater.py
2025-10-16T18:44:44.002Z -rwxr-xr-x 1 root root 8114 Sep 19 21:12 load-test.sh
2025-10-16T18:44:44.002Z -rw-r--r-- 1 root root 1097 Oct 16 14:40 locustfile.py
2025-10-16T18:44:44.002Z -rw-r--r-- 1 root root 3167 Oct 16 18:43 mIiFQHRMqs.zip
2025-10-16T18:44:44.002Z -rw-r--r-- 1 root root 2099 Oct 16 14:42 package.py
2025-10-16T18:44:44.002Z drwxr-xr-x 2 root root 4096 Oct 16 18:44 templates
2025-10-16T18:44:44.002Z -rw-r--r-- 1 root root 334 Oct 16 18:43 test.json
2025-10-16T18:44:44.010Z ./package.py

That last line shows the wrong selection for the locustfile - it picked "package.py" instead. You can see the bug where the solution picks the locustfile, but then replaces it with the first found .py file - this is an issue.

To Reproduce
Upload a .zip containing both a locustfile.py and some other python files - the detection logic in load-test.sh will sometimes pull the wrong file due to a bug.

Expected behavior
The test should always pick the locustfile.py, rather than another file

Please complete the following information about the solution:

  • Version: 3.4.4
  • Region: all
  • Was the solution modified from the version published on this repository? No
  • Were there any errors in the CloudWatch Logs? Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions