Skip to content

Failures that happen in after do not trigger a retry #110

@schneems

Description

@schneems

From: https://app.circleci.com/pipelines/github/heroku/hatchet/160/workflows/37a65f89-4da7-4c54-bdb0-09eac28cc942/jobs/474

An error occurred in an `after(:context)` hook.
Failure/Error: @app.run_multi("ls") { |out| expect(out).to include("Gemfile") }
  expected "" to include "Gemfile"
# ./spec/hatchet/app_spec.rb:217:in `block (4 levels) in <top (required)>'
# ./lib/hatchet/app.rb:240:in `block in run_multi'

RSpec::Retry: 2nd try ./spec/hatchet/app_spec.rb:174
.

Finished in 22.84 seconds (files took 2.11 seconds to load)
2 examples, 0 failures, 1 error occurred outside of examples

For whatever reason sometimes heroku run <command> comes back empty. I wish I knew why and I would fix it, but until then we're managing the situation through relying on rspec-retry. The problem is that the logic in this test doesn't propagate while inside of the test context but instead in the after(:all) step:

    before(:all) do
      skip("Must set HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"]

      @app = Hatchet::GitApp.new("default_ruby", run_multi: true)
      @app.deploy
    end

    after(:all) do
      @app.teardown! if @app # <====== ERROR fires here because it's where we're waiting on threads to join
    end

    it "test one" do
      @app.run_multi("ls") { |out| expect(out).to include("Gemfile") }  # <== This is where the thread is spawned that the error comes from
      expect(@app.platform_api.formation.list(@app.name).detect {|ps| ps["type"] == "web"}["size"].downcase).to_not eq("free")
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions