Skip to content

Commit

Permalink
Merge pull request #576 from tezc/repeat-tests
Browse files Browse the repository at this point in the history
Add option to repeat tests
  • Loading branch information
tezc committed Jan 31, 2023
2 parents 49b292c + d19a3d8 commit 5c9c838
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
description: 'git branch or sha to use'
required: false
default: 'master'
pytest_args:
description: 'additional pytest args (e.g. run tests matching a regex n times: -k lua --repeat 3)'
required: false
default: ''

jobs:
tests-with-elle:
Expand All @@ -40,7 +44,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
cmake .. -DPYTEST_OPTS="--redis-executable=redis/src/redis-server --elle-cli=elle-cli/target/elle-cli-0.1.5-standalone.jar --elle-threads=3 -v"
cmake .. -DPYTEST_OPTS="--redis-executable=redis/src/redis-server --elle-cli=elle-cli/target/elle-cli-0.1.5-standalone.jar --elle-threads=3 -v ${{github.event.inputs.pytest_args}}"
make
- name: Checkout Redis
uses: actions/checkout@v2
Expand Down Expand Up @@ -92,7 +96,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
cmake .. -DSANITIZER=address -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v"
cmake .. -DSANITIZER=address -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v ${{github.event.inputs.pytest_args}}"
make
- name: Checkout Redis
uses: actions/checkout@v2
Expand Down Expand Up @@ -136,7 +140,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
cmake .. -DSANITIZER=undefined -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v"
cmake .. -DSANITIZER=undefined -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v ${{github.event.inputs.pytest_args}}"
make
- name: Checkout Redis
uses: actions/checkout@v2
Expand Down Expand Up @@ -180,7 +184,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
cmake .. -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v"
cmake .. -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v ${{github.event.inputs.pytest_args}}"
make
- name: Checkout Redis
uses: actions/checkout@v2
Expand Down Expand Up @@ -225,7 +229,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
cmake .. -DSANITIZER=address -DBUILD_TLS=1 -DPYTEST_OPTS="--redis-executable=redis/src/redis-server --tls -v"
cmake .. -DSANITIZER=address -DBUILD_TLS=1 -DPYTEST_OPTS="--redis-executable=redis/src/redis-server --tls -v ${{github.event.inputs.pytest_args}}"
make
- name: Checkout Redis
uses: actions/checkout@v2
Expand Down Expand Up @@ -257,7 +261,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
cmake .. -DSANITIZER=address -DBUILD_TLS=1 -DPYTEST_OPTS="--redis-executable=redis/src/redis-server --tls -v"
cmake .. -DSANITIZER=address -DBUILD_TLS=1 -DPYTEST_OPTS="--redis-executable=redis/src/redis-server --tls -v ${{github.event.inputs.pytest_args}}"
make
- name: Checkout Redis
uses: actions/checkout@v2
Expand Down Expand Up @@ -303,7 +307,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
cmake .. -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v"
cmake .. -DPYTEST_OPTS="--redis-executable=redis/src/redis-server -v ${{github.event.inputs.pytest_args}}"
make -j 4
- name: Checkout Redis
uses: actions/checkout@v2
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ def pytest_addoption(parser):
parser.addoption(
'--elle-ops-per-tx', default=1,
help='number of append/read pairs per transaction')
parser.addoption(
'--repeat', action='store',
help='Number of times to repeat each test')


def pytest_generate_tests(metafunc):
if metafunc.config.option.repeat is not None:
count = int(metafunc.config.option.repeat)

metafunc.fixturenames.append('repeat_test')
metafunc.parametrize('repeat_test', range(count))


def pytest_configure(config):
Expand Down

0 comments on commit 5c9c838

Please sign in to comment.