FIX: `docker:test` Rake task did not run system tests in parallel (#24507)

Why this change?

We support a `USE_TURBO` environment variable which tells the
`docker:test` rake task to run rspec tests in parallel. However, this
currently does not apply to system tests.

What does this change do?

This commit runs system specs for both core and plugins using
`./bin/turbo_rspec` when the `USE_TURBO` environment is present. Note
that when running system specs, we will only spawn X number of test
processes where X is half the number of available CPU cores. This is
done because we have to leave CPU resources for the chrome processes
that will be created.
This commit is contained in:
Alan Guo Xiang Tan 2023-11-22 11:51:43 +08:00 committed by GitHub
parent 38abd471b6
commit 86da47f58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 5 deletions

View File

@ -78,6 +78,10 @@ def migrate_databases(parallel: false, load_plugins: false)
success
end
def system_tests_parallel_tests_processors_env
"PARALLEL_TEST_PROCESSORS=#{Etc.nprocessors / 2}"
end
# Environment Variables (specific to this rake task)
desc "Setups up the test environment"
task "docker:test:setup" do
@ -214,6 +218,8 @@ task "docker:test" do
)
unless ENV["JS_ONLY"]
@good &&= run_or_fail("bin/ember-cli --build") if ENV["RUN_SYSTEM_TESTS"]
if ENV["WARMUP_TMP_FOLDER"]
run_or_fail("bundle exec rspec ./spec/requests/groups_controller_spec.rb")
end
@ -236,14 +242,21 @@ task "docker:test" do
end
if ENV["RUN_SYSTEM_TESTS"]
@good &&= run_or_fail("bin/ember-cli --build")
@good &&= run_or_fail("timeout --verbose 1800 bundle exec rspec spec/system")
@good &&=
if ENV["USE_TURBO"]
run_or_fail(
"#{system_tests_parallel_tests_processors_env} timeout --verbose 1800 bundle exec ./bin/turbo_rspec spec/system",
)
else
run_or_fail("timeout --verbose 1800 bundle exec rspec spec/system")
end
end
end
unless ENV["SKIP_PLUGINS"]
if ENV["SINGLE_PLUGIN"]
@good &&= run_or_fail("bundle exec rake plugin:spec['#{ENV["SINGLE_PLUGIN"]}']")
if ENV["RUN_SYSTEM_TESTS"]
@good &&=
run_or_fail(
@ -254,11 +267,18 @@ task "docker:test" do
fail_fast = "RSPEC_FAILFAST=1" unless ENV["SKIP_FAILFAST"]
task = ENV["USE_TURBO"] ? "plugin:turbo_spec" : "plugin:spec"
@good &&= run_or_fail("#{fail_fast} bundle exec rake #{task}")
if ENV["RUN_SYSTEM_TESTS"]
@good &&=
run_or_fail(
"LOAD_PLUGINS=1 timeout --verbose 1600 bundle exec rspec plugins/*/spec/system".strip,
)
if ENV["USE_TURBO"]
run_or_fail(
"LOAD_PLUGINS=1 #{system_tests_parallel_tests_processors_env} timeout --verbose 1600 bundle exec ./bin/turbo_rspec plugins/*/spec/system",
)
else
run_or_fail(
"LOAD_PLUGINS=1 timeout --verbose 1600 bundle exec rspec plugins/*/spec/system",
)
end
end
end
end