voxpupuli / onceover

Your gateway drug to automated infrastructure testing with Puppet
Apache License 2.0
142 stars 45 forks source link

Parallel test execution fails since version 1.17.1 #285

Open DLeich opened 4 years ago

DLeich commented 4 years ago

It looks like parallel test execution has been broken since 1.17.1 was released. I get the following output when executing bundle exec onceover run spec --parallel on every version after 1.17.0:

Error while running: #<NoMethodError: undefined method `cooked!' for #<IO:<STDERR>>>

alexjfisher commented 3 years ago

Fixed in #280

Can you work around by adding require 'io/console' to the end of your Gemfile?

DLeich commented 3 years ago

Confirmed that adding require 'io/console' worked. Thanks! I'm guessing this will be officially fixed with the next release, since #280 has already been merged.

codylane commented 3 years ago

Just posting as I have also been testing this and adding require 'io/console to my Gemfile.

After whacking the Gemfile.lock and running bundle install the once over--parallel execution started working.

I'm also curious if you think it would be a good idea to test for the #coooked! method prior to using it?

For example this line: https://github.com/dylanratcliffe/onceover/blob/v3.18.1/lib/onceover/runner.rb#L133

Could also be this

STDERR.cooked! if STDERR.isatty && STDERR.respond_to?(:cooked!)

Or perhaps we could even do this incase there is no TTY and the #cooked! isn't available either.

      begin
        STDERR.raw! if STDERR.isatty
        result = Backticks::Runner.new(interactive: true).run(args.flatten).join
      ensure
        begin
          STDERR.cooked! if STDERR.isatty
        rescue NoMethodError
          STDERR.write("My custom error message...")
        end
     end