Test-reports cause tests to fail

Hello, I’m dealing with this weird issue when I do store_test_reports that make some tests fail. Said tests run and pass if I remove this step.
Here is my full config file:

aliases:
    # Environments
    - &test_environment
        working_directory: ~/alp
        docker:
            - image: circleci/ruby:2.3.4
              environment:
                RAILS_ENV: test
            - image: circleci/mysql:5.6-ram
              environment:
                MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
                MYSQL_ROOT_PASSWORD: ''
                MYSQL_DATABASE: circle_test
    # Steps
    - &restore_gem_cache
        keys: 
            - v1-gemfile-deps-{{ checksum "Gemfile.lock" }}
            - v1-gemfile-deps-

    - &save_gem_cache
        key: v1-gemfile-deps-{{ checksum "Gemfile.lock" }}
        paths: 
            - ~/alp/vendor/bundle
    
    - &bundle_install
        name: Install Gems
        command: bundle install --path=vendor/bundle --jobs=4 --retry=3  
    
    - &attach_workspace
        attach_workspace:
                at: ~/alp

    - &db_setup
        name: Setup DB
        command: bundle exec rake db:setup

    - &run_test
        name: Run Tests
        command: bundle exec rails test
    
    - &run_linter
        name: Run Rubocop Linter
        command: bundle exec rubocop --force-exclusion

    # Jobs
    - &dependencies
        - add_ssh_keys:
            fingerprints:
              [fingerprint]
        - checkout
        - *attach_workspace
        - restore_cache: *restore_gem_cache
        - run: *bundle_install
        - save_cache: *save_gem_cache
        - persist_to_workspace:
            root: .
            paths:
                - vendor/bundle

    - &database_and_run_tests
        - checkout
        - *attach_workspace
        - run: *bundle_install
        - run: cp ~/alp/config/database.yml.example ~/alp/config/database.yml
        - run: *db_setup
        - run: *run_linter
        - run: *run_test
        - store_test_results:
            path: test
        - store_artifacts:
            path: coverage

        
    

version: 2
workflows:
  version: 2
  build-and-test:
    jobs:
      - "Dependencies"
      - "Database and Test":
          requires:
            - "Dependencies"
          context: TestAlpenrose

jobs:
    "Dependencies":
        <<: *test_environment
        steps: *dependencies

    "Database and Test":
        <<: *test_environment
        steps: *database_and_run_tests

Any help would be amazing.
Thank you

Hello. What I suspect is happening is your test runner exits with a code of 0 even when there are failed tests. To confirm this, can you expand the green test step and see if the same tests are failing in that step?

Turns out the reason was unrelated to test-reports. This topic can be closed. Thanks

1 Like