Add 300s timeout to test cases
What does this MR do and why?
Add 100s timeout to test cases.
- file_path: 'spec/services/projects/import_service_spec.rb'
description:
- 'Projects::ImportService#execute with valid importer when importer when lfs import fails logs the error'
- 'Projects::ImportService#execute with valid importer when importer does not have a custom repository importer downloads lfs objects'
skip_reason: 'skip flaky cases: timeout'
Jobs that failed due to timeout:
- https://jihulab.com/gitlab-cn/gitlab/-/jobs/6491610
- https://jihulab.com/gitlab-cn/gitlab/-/jobs/6491079
Letting abnormal tests fail as soon as possible can help save a lot of waiting time.
Demo
cbd@mbp16 gitlab % spec spec/services/projects/import_service_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Test environment set up in 8.807745 seconds
.....................FF........
Failures:
1) Projects::ImportService#execute with valid importer when importer does not have a custom repository importer downloads lfs objects
Got 1 failure and 1 other error:
1.1) Failure/Error: example.run
Exactly one instance should have received the following message(s) but didn't: execute
# ./spec/spec_helper.rb:509:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:501:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:497:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/application_context.rb:59:in `with_raw_context'
# ./spec/spec_helper.rb:497:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:239:in `block (2 levels) in <top (required)>'
# ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (3 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (2 levels) in <main>'
1.2) Failure/Error: stub(service, storage).__send__(rpc, request, kwargs) # rubocop:disable GitlabSecurity/PublicSend
Timeout::Error:
execution expired
# ./lib/gitlab/gitaly_client.rb:185:in `execute'
# ./lib/gitlab/gitaly_client/call.rb:18:in `block in call'
# ./lib/gitlab/gitaly_client/call.rb:55:in `recording_request'
# ./lib/gitlab/gitaly_client/call.rb:17:in `call'
# ./lib/gitlab/gitaly_client.rb:175:in `call'
# ./lib/gitlab/gitaly_client/with_feature_flag_actors.rb:31:in `block in gitaly_client_call'
# ./lib/gitlab/gitaly_client.rb:541:in `with_feature_flag_actors'
# ./lib/gitlab/gitaly_client/with_feature_flag_actors.rb:25:in `gitaly_client_call'
# ./lib/gitlab/gitaly_client/repository_service.rb:158:in `import_repository'
# ./lib/gitlab/git/repository.rb:909:in `block in import_repository'
# ./lib/gitlab/git/wraps_gitaly_errors.rb:7:in `wrapped_gitaly_errors'
# ./lib/gitlab/git/repository.rb:908:in `import_repository'
# ./app/services/projects/import_service.rb:100:in `import_repository'
# ./app/services/projects/import_service.rb:83:in `add_repository_to_project'
# ./app/services/projects/import_service.rb:21:in `execute'
# ./spec/services/projects/import_service_spec.rb:281:in `block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:509:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:501:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:497:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/application_context.rb:59:in `with_raw_context'
# ./spec/spec_helper.rb:497:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:239:in `block (2 levels) in <top (required)>'
# ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (3 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (2 levels) in <main>'
2) Projects::ImportService#execute with valid importer when importer when lfs import fails logs the error
Got 1 failure and 1 other error:
2.1) Failure/Error: expect(Gitlab::AppLogger).to receive(:error).with("The Lfs import process failed. #{error_message}")
(Gitlab::AppLogger (class)).error("The Lfs import process failed. error message")
expected: 1 time with arguments: ("The Lfs import process failed. error message")
received: 0 times
# ./spec/services/projects/import_service_spec.rb:290:in `block (6 levels) in <top (required)>'
# ./spec/spec_helper.rb:509:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:501:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:497:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/application_context.rb:59:in `with_raw_context'
# ./spec/spec_helper.rb:497:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:239:in `block (2 levels) in <top (required)>'
# ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (3 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (2 levels) in <main>'
2.2) Failure/Error: stub(service, storage).__send__(rpc, request, kwargs) # rubocop:disable GitlabSecurity/PublicSend
Timeout::Error:
execution expired
# ./lib/gitlab/gitaly_client.rb:185:in `execute'
# ./lib/gitlab/gitaly_client/call.rb:18:in `block in call'
# ./lib/gitlab/gitaly_client/call.rb:55:in `recording_request'
# ./lib/gitlab/gitaly_client/call.rb:17:in `call'
# ./lib/gitlab/gitaly_client.rb:175:in `call'
# ./lib/gitlab/gitaly_client/with_feature_flag_actors.rb:31:in `block in gitaly_client_call'
# ./lib/gitlab/gitaly_client.rb:541:in `with_feature_flag_actors'
# ./lib/gitlab/gitaly_client/with_feature_flag_actors.rb:25:in `gitaly_client_call'
# ./lib/gitlab/gitaly_client/repository_service.rb:158:in `import_repository'
# ./lib/gitlab/git/repository.rb:909:in `block in import_repository'
# ./lib/gitlab/git/wraps_gitaly_errors.rb:7:in `wrapped_gitaly_errors'
# ./lib/gitlab/git/repository.rb:908:in `import_repository'
# ./app/services/projects/import_service.rb:100:in `import_repository'
# ./app/services/projects/import_service.rb:83:in `add_repository_to_project'
# ./app/services/projects/import_service.rb:21:in `execute'
# ./spec/services/projects/import_service_spec.rb:292:in `block (6 levels) in <top (required)>'
# ./spec/spec_helper.rb:509:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:501:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:497:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/application_context.rb:59:in `with_raw_context'
# ./spec/spec_helper.rb:497:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:239:in `block (2 levels) in <top (required)>'
# ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (3 levels) in <main>'
# ./spec/support/database/prevent_cross_joins.rb:62:in `with_cross_joins_prevented'
# ./spec/support/database/prevent_cross_joins.rb:108:in `block (2 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (3 levels) in <main>'
# ./jh/spec/spec_helper.rb:30:in `block (2 levels) in <main>'
Finished in 46.04 seconds (files took 24.76 seconds to load)
31 examples, 2 failures
Failed examples:
rspec ./spec/services/projects/import_service_spec.rb:276 # Projects::ImportService#execute with valid importer when importer does not have a custom repository importer downloads lfs objects
rspec ./spec/services/projects/import_service_spec.rb:285 # Projects::ImportService#execute with valid importer when importer when lfs import fails logs the error
[TEST PROF INFO] Time spent in factories: 00:12.596 (25.52% of total time)
由 Baodong 编辑于