Giter VIP home page Giter VIP logo

Comments (4)

geoffharcourt avatar geoffharcourt commented on August 22, 2024 1

Hi @ArturT your code is the workaround we're currently using, I was just wondering if there was a more straightforward way!

BTW, we normally run in queue mode in CI, I just had that command shortened for the test I was running locally. (Assuming that doesn't make a difference.)

Thanks for your help!

from knapsack_pro-ruby.

geoffharcourt avatar geoffharcourt commented on August 22, 2024 1

Interesting! We will investigate! Thanks for your help.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on August 22, 2024

Hi @geoffharcourt

I see you use Knapsack Pro in Regular Mode. In the Regular Mode, we invoke the RSpec rake task. I'm not sure why it does not respect the --failure-exit-code=3 option.

Maybe you could create a bash script bin/knapsack_pro_run_tests and override the exit code:

#!/bin/bash

# run tests in parallel with Knapsack Pro Regular Mode for RSpec
bundle exec rake knapsack_pro:rspec
export KNAPSACK_PRO_EXIT_CODE=$?

# process should exit with non zero exit code when one of test failed
if [ "$KNAPSACK_PRO_EXIT_CODE" -ne "1" ]; then
  exit 3
fi

from knapsack_pro-ruby.

ArturT avatar ArturT commented on August 22, 2024

In the Queue Mode the non-zero exit code from the RSpec is remembered for each batch of tests fetched from Knapsack Pro API Queue.

A non-zero exit code should be returned in the Queue Mode:

exitstatus = exit_code if exit_code != 0

I've just manually tested the Queue Mode and the --failure-exit-code=3 option. When my test case is failing then knapsack_pro gem returns 3 as the exit code

bundle exec rake "knapsack_pro:queue:rspec[--format d --failure-exit-code 3]"
...some output from running test
echo $? # run this to preview the exit code
3

Maybe knapsack_pro is not the last command in your CI pipeline and that is why your CI does not see 3 as exit code?

from knapsack_pro-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.