From 8b0e95ece8ed77e38e8e3537d8ef45214a9bcf48 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Wed, 5 Oct 2022 10:59:31 -0700 Subject: [PATCH] fix: Flakiness in CI pipeline (#5562) - Fixing the recent flakiness in CI pipelines --- .circleci/config.yml | 9 ++++++--- Gemfile | 1 + Gemfile.lock | 5 ++++- spec/factories/articles.rb | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a9e0bd450..fbb4fea90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,6 +19,7 @@ defaults: &defaults - COVERAGE: true - LOG_LEVEL: warn parallelism: 4 + resource_class: large jobs: build: @@ -122,9 +123,11 @@ jobs: mkdir -p coverage ~/tmp/cc-test-reporter before-build TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - bundle exec rspec --profile 10 \ - --out test-results/rspec/rspec.xml \ + bundle exec rspec --format progress \ + --format RspecJunitFormatter \ + --out ~/tmp/test-results/rspec.xml \ -- ${TESTFILES} + no_output_timeout: 30m - run: name: Code Climate Test Coverage command: | @@ -137,7 +140,7 @@ jobs: ~/tmp/cc-test-reporter before-build TESTFILES=$(circleci tests glob **/specs/*.spec.js | circleci tests split --split-by=timings) yarn test:coverage --profile 10 \ - --out test-results/frontend_specs/rspec.xml \ + --out ~/tmp/test-results/yarn.xml \ -- ${TESTFILES} - run: name: Code Climate Test Coverage diff --git a/Gemfile b/Gemfile index ca6c7856d..d47b5e449 100644 --- a/Gemfile +++ b/Gemfile @@ -174,6 +174,7 @@ group :development, :test do gem 'listen' gem 'mock_redis' gem 'pry-rails' + gem 'rspec_junit_formatter' gem 'rspec-rails', '~> 5.0.0' gem 'rubocop', require: false gem 'rubocop-performance', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 5cf4f020d..e8095a5e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -536,6 +536,8 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.11.0) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) rubocop (1.31.2) json (~> 2.3) parallel (~> 1.10) @@ -769,6 +771,7 @@ DEPENDENCIES responders rest-client rspec-rails (~> 5.0.0) + rspec_junit_formatter rubocop rubocop-performance rubocop-rails @@ -805,4 +808,4 @@ RUBY VERSION ruby 3.0.4p208 BUNDLED WITH - 2.3.17 + 2.3.18 diff --git a/spec/factories/articles.rb b/spec/factories/articles.rb index 30c842621..ec9c4cd2d 100644 --- a/spec/factories/articles.rb +++ b/spec/factories/articles.rb @@ -3,7 +3,7 @@ FactoryBot.define do account_id { 1 } category_id { 1 } author_id { 1 } - title { Faker::Movie.title } + title { "#{Faker::Movie.title} #{SecureRandom.hex}" } content { 'MyText' } description { 'MyDescrption' } status { 1 }