Fix isolated shard loading and docker shard task
This commit is contained in:
parent
031f40a85d
commit
71cedbd33d
|
|
@ -19,6 +19,7 @@ Examples:
|
||||||
- `inv blackbox-production`
|
- `inv blackbox-production`
|
||||||
- `inv scenario-main-usecase`
|
- `inv scenario-main-usecase`
|
||||||
- `inv docker-build-all`
|
- `inv docker-build-all`
|
||||||
|
- `inv docker-test-shard --node-index=3 --node-total=8`
|
||||||
- `inv docker-test-http-e2e`
|
- `inv docker-test-http-e2e`
|
||||||
|
|
||||||
The GitLab CI pipeline is expected to use these tasks as well.
|
The GitLab CI pipeline is expected to use these tasks as well.
|
||||||
|
|
|
||||||
19
tasks.py
19
tasks.py
|
|
@ -322,7 +322,10 @@ def test_shard(c, node_index=1, node_total=8, dry_run=False):
|
||||||
if not files:
|
if not files:
|
||||||
return
|
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
|
@task
|
||||||
|
|
@ -722,3 +725,17 @@ def docker_test_http_e2e(
|
||||||
"kill \\$SERVER_PID\""
|
"kill \\$SERVER_PID\""
|
||||||
)
|
)
|
||||||
c.run(command, pty=True)
|
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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue