From ccda2e852045a50b88edeeac7724f73bb4b85c1a Mon Sep 17 00:00:00 2001 From: adi-herwana-nus Date: Tue, 1 Oct 2024 10:00:21 +0800 Subject: [PATCH] test: other test improvements - added missing translations from #7542 - migrated away from deprecated codecov gem --- .circleci/config.yml | 12 ++++++------ Gemfile | 2 +- Gemfile.lock | 7 ++++--- config/initializers/coverage.rb | 4 ++-- .../zh/activerecord/course/monitoring/heartbeat.yml | 8 ++++++++ .../zh/activerecord/course/monitoring/monitor.yml | 4 ++++ 6 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 config/locales/zh/activerecord/course/monitoring/heartbeat.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index d664864f8db..b7f0681ac40 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -226,7 +226,7 @@ commands: - run: name: Wait for Rails coverage results no_output_timeout: 5m - command: until [ -f coverage/codecov-result.json ]; do sleep 1; done + command: until [ -f coverage/coverage.xml ]; do sleep 1; done setup_docker_layer_cache: steps: @@ -301,13 +301,9 @@ jobs: command: | zip -r test-results.zip test-results playright-report - # - codecov/upload: - # upload_name: playwright-client - # file: tests/coverage/lcov.info - - codecov/upload: upload_name: playwright-rails - file: coverage/codecov-result.json + file: coverage/coverage.xml - store_test_results: path: ~/repo/tests/results.xml @@ -343,6 +339,10 @@ jobs: mkdir ~/rspec circleci tests glob "spec/**/*_spec.rb" | circleci tests run --command="xargs bundle exec rspec --format progress --format RspecJunitFormatter -o ~/rspec/rspec.xml" --verbose --split-by=timings + - codecov/upload: + upload_name: rspec-rails + file: coverage/coverage.xml + - store_test_results: path: ~/rspec diff --git a/Gemfile b/Gemfile index aeedf342ace..2d1872bf20f 100644 --- a/Gemfile +++ b/Gemfile @@ -131,7 +131,7 @@ group :development, :test do # Code Coverage reporters gem 'simplecov' - gem 'codecov', require: false + gem 'simplecov-cobertura' gem 'dotenv-rails' end diff --git a/Gemfile.lock b/Gemfile.lock index c5a4043b70c..1fd881cc195 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -173,8 +173,6 @@ GEM marcel (~> 1.0.0) ssrf_filter (~> 1.0) childprocess (5.0.0) - codecov (0.6.0) - simplecov (>= 0.15, < 0.22) concurrent-ruby (1.3.4) connection_pool (2.4.1) consistency_fail (0.3.7) @@ -554,6 +552,9 @@ GEM docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) slim (5.2.1) @@ -623,7 +624,6 @@ DEPENDENCIES capybara-screenshot capybara-selenium carrierwave (~> 3) - codecov consistency_fail coursemology-polyglot csv @@ -689,6 +689,7 @@ DEPENDENCIES sidekiq sidekiq-cron simplecov + simplecov-cobertura slim-rails spring stackprof diff --git a/config/initializers/coverage.rb b/config/initializers/coverage.rb index abeaa6e3f43..c1bee8f5c71 100644 --- a/config/initializers/coverage.rb +++ b/config/initializers/coverage.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true if Rails.env.test? && ENV['COLLECT_COVERAGE'] == 'true' require 'simplecov' - require 'codecov' + require 'simplecov-cobertura' - SimpleCov.formatter = SimpleCov::Formatter::Codecov + SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter SimpleCov.start('rails') do add_filter '/lib/extensions/legacy/active_record/connection_adapters/table_definition.rb' diff --git a/config/locales/zh/activerecord/course/monitoring/heartbeat.yml b/config/locales/zh/activerecord/course/monitoring/heartbeat.yml new file mode 100644 index 00000000000..a47c9b5d524 --- /dev/null +++ b/config/locales/zh/activerecord/course/monitoring/heartbeat.yml @@ -0,0 +1,8 @@ +zh: + activerecord: + errors: + models: + course/monitoring/heartbeat: + attributes: + seb_payload: + invalid_seb_payload: 'seb payload 必须为空或为有效的 JSON 对象' diff --git a/config/locales/zh/activerecord/course/monitoring/monitor.yml b/config/locales/zh/activerecord/course/monitoring/monitor.yml index 1a54f1c4af4..63a58d888d1 100644 --- a/config/locales/zh/activerecord/course/monitoring/monitor.yml +++ b/config/locales/zh/activerecord/course/monitoring/monitor.yml @@ -8,3 +8,7 @@ zh: must_be_password_protected: '评估必须受密码保护才能启用' max_interval_ms: greater_than_min_interval: '必须大于最小间隔' + blocks: + must_have_browser_authorization_and_session_protection: '必须启用浏览器授权和会话保护' + seb_config_key: + required_if_using_seb_config_key_browser_authorization: '使用 seb 配置密钥浏览器授权方法时必须提供 seb 配置密钥'