Fix isolated shard loading and docker shard task

This commit is contained in:
Daniel Schädler 2026-04-11 15:50:19 +02:00
parent 031f40a85d
commit 71cedbd33d
2 changed files with 19 additions and 1 deletions

View File

@ -19,6 +19,7 @@ Examples:
- `inv blackbox-production`
- `inv scenario-main-usecase`
- `inv docker-build-all`
- `inv docker-test-shard --node-index=3 --node-total=8`
- `inv docker-test-http-e2e`
The GitLab CI pipeline is expected to use these tasks as well.

View File

@ -322,7 +322,10 @@ def test_shard(c, node_index=1, node_total=8, dry_run=False):
if not files:
return
c.run("bundle exec rspec " + " ".join(shlex.quote(path) for path in files), pty=True)
c.run(
"bundle exec rspec --require ./spec/rails_helper " + " ".join(shlex.quote(path) for path in files),
pty=True,
)
@task
@ -722,3 +725,17 @@ def docker_test_http_e2e(
"kill \\$SERVER_PID\""
)
c.run(command, pty=True)
@task(name="docker-test-shard")
def docker_test_shard(c, node_index=1, node_total=8, image=TEST_TAG, build=True):
"""Run one Rails-spec shard inside the test Docker image."""
if build:
docker_build_all(c)
command = (
f"docker run --rm {image} bash -lc "
f"\"cd /app && bundle exec rails db:migrate && "
f"inv test-shard --node-index={node_index} --node-total={node_total}\""
)
c.run(command, pty=True)