Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/stress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: stress
on:
schedule:
- cron: "* * * * *"
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cron schedule "* * * * *" will run every minute, which is likely not intended for a stress test workflow. This could lead to excessive resource usage and GitHub Actions quota consumption. Consider using a more reasonable schedule, such as:

  • Daily: "0 0 * * *" (midnight UTC)
  • Weekly: "0 0 * * 0" (Sunday midnight UTC)
  • Or disable the schedule entirely if manual triggers are preferred
Suggested change
- cron: "* * * * *"
- cron: "0 0 * * *"

Copilot uses AI. Check for mistakes.
workflow_dispatch:
inputs:
repeat_count:
description: "Number of times to repeat each test"
required: false
default: "100"
parallel_workers:
description: "Number of parallel workers (-n auto or specific number)"
required: false
default: "auto"

jobs:
stress-test:
name: ${{ matrix.project }} stress test (python-${{ matrix.python-version }}, nats-server-${{ matrix.nats-server-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stress test job lacks a timeout setting. Running 100 test iterations (the default count) could potentially take a very long time, especially on slower runners. Consider adding a timeout-minutes setting to the job to prevent it from running indefinitely if tests hang or take unexpectedly long. For reference, the regular test workflow uses timeout-minutes: 20.

Suggested change
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20

Copilot uses AI. Check for mistakes.
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
nats-server-version: ["latest"]
project: ["nats-server"]
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "stable"

- name: Install NATS Server
run: |
go install github.com/nats-io/nats-server/v2@${{ matrix.nats-server-version }}
shell: bash

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies
run: uv sync --dev
working-directory: ${{ matrix.project }}

- name: Run stress tests for ${{ matrix.project }}
run: uv run pytest -v -n ${{ github.event.inputs.parallel_workers || 'auto' }} --count=${{ github.event.inputs.repeat_count || '100' }}
working-directory: ${{ matrix.project }}

- name: Upload failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: stress-test-failures-${{ matrix.os }}-py${{ matrix.python-version }}
path: ${{ matrix.project }}/.pytest_cache/
retention-days: 7
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dev-dependencies = [
"pytest-asyncio>=0.21.0",
"pytest-cov>=7.0.0",
"pytest-xdist>=3.0.0",
"pytest-repeat>=0.9.0",
"ty>=0.0.0a6",
"ruff>=0.1.0",
"codespell>=2.2.0",
Expand Down
13 changes: 13 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading