Skip to content

✨ feat(loadtest): add list-users command and default locustfile directory #360

@sodre

Description

@sodre

Problem or Use Case

The loadtest run and loadtest tune commands currently require -f/--locustfile to be explicitly passed every time. Since all user classes live in examples/locust/locustfiles/, this should be the default. Additionally, there is no way to discover available Locust user classes without manually inspecting the directory.

These are the two remaining items from #346 (cascade user classes).

Proposed Solution

1. Default -f/--locustfile to the locustfiles directory

Make -f/--locustfile default to the examples/locust/locustfiles/ directory instead of being required. When a directory is passed, Locust auto-discovers all *User classes in all .py files within it.

# Before: required flag
zae-limiter loadtest run --name my-app -f examples/locust/locustfiles/simple.py

# After: defaults to locustfiles directory, discovers all user classes
zae-limiter loadtest run --name my-app
zae-limiter loadtest run --name my-app SimpleCascadeUser  # filter to specific class

2. Add loadtest list-users command

Wraps locust -f <dir> --list to show available user classes without starting a load test.

zae-limiter loadtest list-users

This aligns with Locust's native user class discovery mechanism.

Acceptance Criteria

  • -f/--locustfile defaults to the examples/locust/locustfiles/ directory in loadtest run and loadtest tune commands
  • loadtest list-users command exists and runs locust -f <locustfiles_dir> --list
  • loadtest list-users accepts optional -f/--locustfile override
  • Running zae-limiter loadtest list-users outputs available user classes (e.g., SimpleUser, SimpleCascadeUser, MaxRpsUser, MaxRpsCascadeUser)

Files

  • src/zae_limiter/loadtest/cli.py

Dependencies

Depends on #346 (cascade user classes already merged into the branch).

Parent: #340

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliCommand line interfaceperformancePerformance optimization

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions