diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 9a9688ea1c0ca25bc283e53d1c66d8f09e855307..2467975ff9a045b2a72191fc2772c7bb1d9edc9d 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -320,7 +320,7 @@ rspec fast_spec_helper: script: - fast_spec_helper_specs=$(git grep -l -E '^require.*fast_spec_helper') # Load fast_spec_helper as well just in case there are no specs available. - - bin/rspec --dry-run spec/fast_spec_helper.rb $fast_spec_helper_specs + - rspec_section bin/rspec --dry-run spec/fast_spec_helper.rb ${fast_spec_helper_specs} rspec unit clickhouse: extends: @@ -1236,7 +1236,7 @@ rspec-ee system pg16 es8: stage: test script: - !reference [.base-script, script] - - rspec_fail_fast "${MATCHING_TESTS_PATH}" "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~zoekt --tag ~click_house" + - rspec_section rspec_fail_fast "${MATCHING_TESTS_PATH}" "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~zoekt --tag ~click_house" rspec fail-fast: extends: @@ -1315,7 +1315,7 @@ fail-pipeline-early: - job: "detect-previous-failed-tests" script: - !reference [.base-script, script] - - rspec_rerun_previous_failed_tests "${PREVIOUS_FAILED_TESTS_FILE}" + - rspec_section rspec_rerun_previous_failed_tests ${PREVIOUS_FAILED_TESTS_FILE} rspec rspec-pg14-rerun-previous-failed-tests: extends: diff --git a/.gitlab/ci/rails/shared.gitlab-ci.yml b/.gitlab/ci/rails/shared.gitlab-ci.yml index 12a3dde31d8ccb50adc2bfd06f395ddd8985228a..ec2f48b3ac39244747559a48c2d44ffce848f04e 100644 --- a/.gitlab/ci/rails/shared.gitlab-ci.yml +++ b/.gitlab/ci/rails/shared.gitlab-ci.yml @@ -27,7 +27,10 @@ include: - section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn" # Do not use 'bundle exec' here - export RSPEC_SKIPPED_TESTS_REPORT_PATH="rspec/skipped_tests-${CI_JOB_ID}.txt" - export RSPEC_RETRIED_TESTS_REPORT_PATH="rspec/retried_tests-${CI_JOB_ID}.txt" - - tooling/bin/create_job_metrics_file || true + - | + section_start "job-metrics" "Create Job Metrics file" + tooling/bin/create_job_metrics_file || true + section_end "job-metrics" .no-redis-cluster: variables: @@ -87,7 +90,7 @@ include: # spec/lib, yet background migration tests are also sitting there, # and they should run on their own jobs so we don't need to run them # in unit tests again. - - rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~level:background_migration --tag ~click_house --tag ~real_ai_request" + - rspec_section rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~level:background_migration --tag ~click_house --tag ~real_ai_request" after_script: - echo -e "\e[0Ksection_start:`date +%s`:report_results_section[collapsed=true]\r\e[0KReport results" - bundle exec gem list gitlab_quality-test_tooling @@ -165,7 +168,7 @@ include: .rspec-base-migration: script: - !reference [.base-script, script] - - rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~zoekt --tag ~click_house" + - rspec_section rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~zoekt --tag ~click_house" after_script: - !reference [.rspec-base, after_script] @@ -187,7 +190,7 @@ include: - cp config/click_house.yml.example config/click_house.yml - 'sed -i "s|url:.*$|url: http://clickhouse:8123|g" config/click_house.yml' - !reference [.base-script, script] - - rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag click_house" + - rspec_section rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag click_house" .rspec-base-pg14-as-if-foss: extends: diff --git a/scripts/utils.sh b/scripts/utils.sh index 5996fe7724c02740d9ec630c5ad2bd30cab51723..7eca5de1d53787b2834f1dfa6cc3653eb1d742a8 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -67,8 +67,9 @@ function test_url() { function section_start () { local section_title="${1}" local section_description="${2:-$section_title}" + local collapsed="${3:-true}" - echo -e "section_start:`date +%s`:${section_title}[collapsed=true]\r\e[0K${section_description}" + echo -e "section_start:`date +%s`:${section_title}[collapsed=${collapsed}]\r\e[0K${section_description}" } function section_end () { @@ -77,6 +78,12 @@ function section_end () { echo -e "section_end:`date +%s`:${section_title}\r\e[0K" } +function rspec_section() { + section_start "rspec" "RSpec" "false" + "$@" + section_end "rspec" +} + function bundle_install_script() { local extra_install_args="${1}"