Skip to content

Commit 765d482

Browse files
committed
test(basic): add bulk operations schema and provider
1 parent ad228cc commit 765d482

15 files changed

Lines changed: 111 additions & 21 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jobs:
6767
6868
- name: Install activerecord and testsuite
6969
run: |
70-
pip install rhosocial-activerecord==1.0.0.dev27
71-
pip install rhosocial-activerecord-testsuite==1.0.0.dev14
70+
pip install git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev28#egg=rhosocial-activerecord
71+
pip install git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev15#egg=rhosocial-activerecord-testsuite
7272
7373
- name: Create postgres scenario config
7474
run: |
@@ -121,21 +121,39 @@ jobs:
121121
python -m pytest \
122122
--rootdir=. \
123123
--confcutdir=. \
124-
"$TESTSUITE_DIR/benchmark/crud" \
124+
"$TESTSUITE_DIR/benchmark/crud/test_delete_async.py" \
125+
"$TESTSUITE_DIR/benchmark/crud/test_delete_sync.py" \
126+
"$TESTSUITE_DIR/benchmark/crud/test_insert_async.py" \
127+
"$TESTSUITE_DIR/benchmark/crud/test_insert_sync.py" \
128+
"$TESTSUITE_DIR/benchmark/crud/test_query_async.py" \
129+
"$TESTSUITE_DIR/benchmark/crud/test_query_sync.py" \
130+
"$TESTSUITE_DIR/benchmark/crud/test_update_async.py" \
131+
"$TESTSUITE_DIR/benchmark/crud/test_update_sync.py" \
125132
"$TESTSUITE_DIR/benchmark/query" \
126133
"$TESTSUITE_DIR/benchmark/transaction" \
127134
"$TESTSUITE_DIR/benchmark/mixin" \
128135
-m benchmark \
129136
--benchmark-size=small \
130137
--benchmark-sort=mean \
138+
--strict-markers \
131139
--tb=short | tee benchmark-output.txt
140+
python -m pytest \
141+
--rootdir=. \
142+
--confcutdir=. \
143+
tests/benchmark/activerecord_bulk \
144+
-m benchmark \
145+
--benchmark-size=small \
146+
--benchmark-sort=mean \
147+
--strict-markers \
148+
--tb=short | tee -a benchmark-output.txt
132149
python -m pytest \
133150
--rootdir=. \
134151
--confcutdir=. \
135152
tests/benchmark/backend \
136153
-m benchmark \
137154
--benchmark-size=small \
138155
--benchmark-sort=mean \
156+
--strict-markers \
139157
--tb=short | tee -a benchmark-output.txt
140158
141159
- name: Run FastAPI benchmark suite
@@ -166,12 +184,16 @@ jobs:
166184
echo
167185
echo "- Python: 3.14"
168186
echo "- postgres: 18"
169-
echo "- Scope: testsuite generic benchmarks + PostgreSQL backend direct benchmarks"
187+
echo "- Scope: testsuite generic benchmarks + ActiveRecord bulk benchmarks + PostgreSQL backend direct benchmarks"
170188
echo "- Size: small"
171189
echo "- Result: benchmark job fails only when benchmark execution or correctness checks fail."
172190
echo
173191
echo '```text'
174-
grep -A 120 "benchmark:" benchmark-output.txt || cat benchmark-output.txt
192+
if [ -f benchmark-output.txt ]; then
193+
grep -A 120 "benchmark:" benchmark-output.txt || tail -n 200 benchmark-output.txt
194+
else
195+
echo "benchmark-output.txt was not generated."
196+
fi
175197
echo '```'
176198
} >> "$GITHUB_STEP_SUMMARY"
177199
@@ -188,7 +210,11 @@ jobs:
188210
echo "- Result: benchmark job fails only when FastAPI benchmark execution or correctness checks fail."
189211
echo
190212
echo '```text'
191-
grep -A 120 "benchmark:" fastapi-benchmark-output.txt || cat fastapi-benchmark-output.txt
213+
if [ -f fastapi-benchmark-output.txt ]; then
214+
grep -A 120 "benchmark:" fastapi-benchmark-output.txt || tail -n 200 fastapi-benchmark-output.txt
215+
else
216+
echo "fastapi-benchmark-output.txt was not generated."
217+
fi
192218
echo '```'
193219
} >> "$GITHUB_STEP_SUMMARY"
194220
@@ -259,8 +285,8 @@ jobs:
259285
260286
- name: Install activerecord and testsuite
261287
run: |
262-
pip install rhosocial-activerecord==1.0.0.dev27
263-
pip install rhosocial-activerecord-testsuite==1.0.0.dev14
288+
pip install git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev28#egg=rhosocial-activerecord
289+
pip install git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev15#egg=rhosocial-activerecord-testsuite
264290
265291
- name: Create postgres scenario config
266292
run: |

‎tests/benchmark/__init__.py‎

Whitespace-only changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Conftest for ActiveRecord bulk benchmark bridge tests."""
2+
3+
from rhosocial.activerecord.testsuite.benchmark.conftest import ( # noqa: F401
4+
benchmark_size,
5+
)
6+
from rhosocial.activerecord.testsuite.benchmark.crud.conftest import ( # noqa: F401
7+
crud_sync_context,
8+
crud_async_context,
9+
)
10+
11+
12+
def pytest_addoption(parser):
13+
try:
14+
parser.addoption(
15+
"--benchmark-size",
16+
action="store",
17+
default="small",
18+
choices=("small", "medium", "large"),
19+
help="Data size for rhosocial benchmark scenarios.",
20+
)
21+
except ValueError:
22+
pass
23+
24+
25+
def pytest_configure(config):
26+
config.addinivalue_line("markers", "benchmark: Mark tests as performance benchmarks")
27+
config.addinivalue_line("markers", "benchmark_crud: Mark CRUD benchmark tests")
28+
config.addinivalue_line("markers", "benchmark_sync: Mark synchronous benchmark tests")
29+
config.addinivalue_line("markers", "benchmark_async: Mark asynchronous benchmark tests")
30+
config.addinivalue_line("markers", "benchmark_write: Mark write-oriented benchmark tests")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Bridge file for bulk_create benchmark tests from the testsuite.
2+
from rhosocial.activerecord.testsuite.benchmark.crud.test_bulk_create_sync import * # noqa: F401, F403
3+
from rhosocial.activerecord.testsuite.benchmark.crud.test_bulk_create_async import * # noqa: F401, F403

‎tests/benchmark/backend/__init__.py‎

Whitespace-only changes.

‎tests/benchmark/backend/conftest.py‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@ class BackendBenchmarkContext:
4242

4343

4444
def pytest_addoption(parser):
45-
parser.addoption(
46-
"--benchmark-size",
47-
action="store",
48-
default="small",
49-
choices=("small", "medium", "large"),
50-
help="Data size for PostgreSQL backend benchmark scenarios.",
51-
)
45+
try:
46+
parser.addoption(
47+
"--benchmark-size",
48+
action="store",
49+
default="small",
50+
choices=("small", "medium", "large"),
51+
help="Data size for PostgreSQL backend benchmark scenarios.",
52+
)
53+
except ValueError:
54+
pass
5255

5356

5457
@pytest.fixture(scope="function")

‎tests/benchmark/backend/test_execute_crud_async.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from rhosocial.activerecord.testsuite.benchmark.crud.fixtures.data import make_user_payload
66

7-
from .workloads import (
7+
from workloads import (
88
DQL_OPTIONS,
99
execute_delete_one_async,
1010
execute_find_one_async,

‎tests/benchmark/backend/test_execute_crud_sync.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from rhosocial.activerecord.testsuite.benchmark.crud.fixtures.data import make_user_payload
66

7-
from .workloads import (
7+
from workloads import (
88
DQL_OPTIONS,
99
execute_delete_one,
1010
execute_find_one,

‎tests/benchmark/backend/test_execute_many_async.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from rhosocial.activerecord.testsuite.benchmark.crud.fixtures.data import make_user_payload
66

7-
from .workloads import execute_many_insert_async
7+
from workloads import execute_many_insert_async
88

99

1010
@pytest.mark.benchmark

‎tests/benchmark/backend/test_execute_many_sync.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from rhosocial.activerecord.testsuite.benchmark.crud.fixtures.data import make_user_payload
66

7-
from .workloads import execute_many_insert
7+
from workloads import execute_many_insert
88

99

1010
@pytest.mark.benchmark

0 commit comments

Comments
 (0)