Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `keys' for nil #242

Closed
Alagaesia93 opened this issue Feb 26, 2024 · 20 comments
Closed

NoMethodError: undefined method `keys' for nil #242

Alagaesia93 opened this issue Feb 26, 2024 · 20 comments
Assignees

Comments

@Alagaesia93
Copy link

Alagaesia93 commented Feb 26, 2024

Hello!

After bumping version to 7.0 my whole RSpec CI fails with this error
NoMethodError: undefined method 'keys' for nil

It must be something connected with dotenv and some env variables, but it started failing only after 7.0 version. I tried to check online, but no luck.

If you need anything else, happy to help!

Full error stack
NoMethodError:
         undefined method `keys' for nil
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/dotenv-3.0.2/lib/dotenv/diff.rb:25:in `added'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/dotenv-3.0.2/lib/dotenv/diff.rb:47:in `any?'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/dotenv-3.0.2/lib/dotenv.rb:78:in `restore'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/dotenv-3.0.2/lib/dotenv/autorestore.rb:9:in `block (2 levels) in <main>'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:372:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:529:in `block in run_owned_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:528:in `each'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:528:in `run_owned_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:615:in `block in run_example_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:614:in `each'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:614:in `run_example_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:485:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:518:in `run_after_example'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:283:in `block in run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `block in run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-rails-6.1.1/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/adapters/rspec_adapter.rb:103:in `block (2 levels) in ensure_no_focus!'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/webmock-3.22.0/lib/webmock/rspec.rb:39:in `block (2 levels) in <main>'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:259:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:646:in `block in run_examples'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `map'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `run_examples'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:607:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:98:in `block (4 levels) in knapsack__run_specs'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:96:in `map'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:96:in `block (3 levels) in knapsack__run_specs'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:82:in `block in with_batch'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:70:in `with_batch'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:93:in `block (2 levels) in knapsack__run_specs'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:92:in `block in knapsack__run_specs'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:74:in `report'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:91:in `knapsack__run_specs'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:50:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:20:in `run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/tasks/queue/rspec.rake:19:in `block (3 levels) in <main>'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `block in execute'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `each'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `execute'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `synchronize'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `invoke_with_call_chain'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/task.rb:188:in `invoke'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:182:in `invoke_task'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block (2 levels) in top_level'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `each'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block in top_level'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:147:in `run_with_threads'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:132:in `top_level'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:83:in `block in run'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:208:in `standard_exception_handling'
       # <filtered>/vendor/bundle/ruby/3.3.0/gems/rake-13.1.0/lib/rake/application.rb:80:in `run'
@ArturT
Copy link
Member

ArturT commented Feb 26, 2024

Hi @Alagaesia93 Thank for reporting this.

What Knapsack Pro command do you call? Do you pass any custom options?

Can you share the full txt output from the CI node? You can share it with support at https://knapsackpro.com/contact for confidentiality.

Have you tried upgrading the dotenv gem and rspec-core to the latest version?

Do you have any specific dotenv configuration?

Do you use config.dotenv.autorestore = true (it's a default)?

@ArturT ArturT added the RSpec label Feb 26, 2024
@Alagaesia93
Copy link
Author

Alagaesia93 commented Feb 27, 2024

Thank you @ArturT for jumping in so quickly!

ci.yml

  rspec:
    env:
      RAILS_ENV: test
      RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
    runs-on: ubuntu-22.04
    timeout-minutes: 20
    needs: [bundle]
    services:
      postgres:
        image: postgres:16
        env:
          POSTGRES_USER: ${{ env.PGUSER }}
          POSTGRES_PASSWORD: ${{ env.PGPASSWORD }}
          POSTGRES_DB: test_sky_pilot
        ports:
          - 5432/tcp
      redis:
        image: redis
        ports:
          - 6379/tcp
    strategy:
      fail-fast: false
      matrix:
        # Set N number of parallel jobs you want to run tests on.
        # Use higher number if you have slow tests to split them on more parallel jobs.
        # Remember to update ci_node_index below to 0..N-1
        ci_node_total: [3]
        # set N-1 indexes for parallel jobs
        # When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc
        ci_node_index: [0, 1, 2]
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: Build DB
        env:
          PGPORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
        run: bin/rails db:schema:load
      - name: Run Rspec Tests
        env:
          PGPORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
          KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
          KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
          KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
          KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
          REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/1
        run: bin/rake knapsack_pro:queue:rspec

not sure what else to add from the CI node, we have hundreds of thousands of tests so it's a gigantic file with the same error repeated for each test :)

I have dotenv (not dotenv-rails) 3.0.2, released few days ago. I see that there is 3.0.3 with some fixes, I'll run CI again
rspec-rails latest version, rspec-core just 3.12.2 instead of 3.12.3

No specific dotenv config, yes autorestore because it's default

The interesting part is knapsack 6.x works perfectly, knapsack 7.0 breaks everything.

EDIT: just tried with dotenv 3.0.3, same error. Please note that bundle exec rspec works perfectly

@ArturT
Copy link
Member

ArturT commented Feb 27, 2024

Could you update rspec-core to 3.13?

Please replace:

run: bin/rake knapsack_pro:queue:rspec

to

bundle exec rake knapsack_pro:queue:rspec

Does it help?

You can also try this:

bundle exec rake knapsack_pro:queue:rspec_go

The interesting part is knapsack 6.x works perfectly, knapsack 7.0 breaks everything.

We did a big refactor for RSpec in Queue Mode. I see the error is coming from the following line. We directly call the RSpec example_group.run(reporter) internal method.

       # <filtered>/vendor/bundle/ruby/3.3.0/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:98:in `block (4 levels) in knapsack__run_specs'

@tmtrademarked
Copy link

I am seeing the same behavior with v7, FWIW. We're using rspec-core 3.13, dotenv 3.0.3, and knapsack-pro 7.0.0. All of our specs fail with the following error:

 2) Spree::Order#phone when ship address is present returns the ship address phone
     Failure/Error: example.run

     NoMethodError:
       undefined method `keys' for nil
     # /usr/local/bundle/gems/dotenv-3.0.3/lib/dotenv/diff.rb:25:in `added'
     # /usr/local/bundle/gems/dotenv-3.0.3/lib/dotenv/diff.rb:47:in `any?'
     # /usr/local/bundle/gems/dotenv-3.0.3/lib/dotenv.rb:78:in `restore'
     # /usr/local/bundle/gems/dotenv-3.0.3/lib/dotenv/autorestore.rb:9:in `block (2 levels) in <top (required)>'
     # ./spec/support/database_cleaner.rb:14:in `block (2 levels) in <top (required)>'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/adapters/rspec_adapter.rb:103:in `block (2 levels) in ensure_no_focus!'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:98:in `block (4 levels) in knapsack__run_specs'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:96:in `map'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:96:in `block (3 levels) in knapsack__run_specs'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:82:in `block in with_batch'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:70:in `with_batch'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:93:in `block (2 levels) in knapsack__run_specs'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:92:in `block in knapsack__run_specs'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/extensions/rspec_extension.rb:91:in `knapsack__run_specs'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:50:in `run'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:20:in `run'
     # /usr/local/bundle/gems/knapsack_pro-7.0.0/lib/tasks/queue/rspec.rake:19:in `block (3 levels) in <main>'

We're running our tests as follows: bundle exec rake "knapsack_pro:queue:rspec[--format Fuubar --format RspecJunitFormatter --out ${REPORT_DIR}/junit-report-${TEST_NODE_INDEX}.xml]"

@ArturT
Copy link
Member

ArturT commented Feb 27, 2024

Thank you, @tmtrademarked, for the details.

We will get back to you. Please share any further information you find about the root issue.

--

I have created an internal ticket for the issue.

@ArturT ArturT added the bug label Feb 27, 2024
@irphilli
Copy link

irphilli commented Feb 28, 2024

I ran into the same thing. Similar gems to what @tmtrademarked mentioned above. Though, we do have this bit of code in our spec_helper:

config.around do |example|
  # Some setup
  example.run
ensure
  # Some cleanup
end

We get the failure at example.run. Just mentioning it in case it helps with the debugging!

@Alagaesia93
Copy link
Author

Alagaesia93 commented Feb 28, 2024

rspec-core updated ✅
ci.yml bundle exec replaced ✅

error gone ❌
Sorry, still having the same issue!

@ArturT
Copy link
Member

ArturT commented Feb 28, 2024

Thanks for the details. I'll get back to you.

@tmtrademarked
Copy link

For more context, I also tried with dotenv 3.1.0 - same results, unfortunately.

@ArturT ArturT added the planned It’s planned to be done label Mar 3, 2024
@Pacyfik
Copy link
Contributor

Pacyfik commented Mar 6, 2024

Hi @Alagaesia93 @tmtrademarked @irphilli I'm Mat and I work with Artur at Knapsack.
Thanks for taking the time to report this and for sending us all the info.
I've identified the issue and I'm currently working on a fix.
In the meantime, could you please try running the knapsack_pro RSpec command on your CI with an additional argument, i.e. change
bundle exec rake knapsack_pro:queue:rspec
to
bundle exec rake "knapsack_pro:queue:rspec[--require rails_helper]"
See if this helps and let me know the result, please.

@Pacyfik Pacyfik self-assigned this Mar 6, 2024
@Pacyfik Pacyfik added wip Work in progress and removed planned It’s planned to be done labels Mar 6, 2024
@tmtrademarked
Copy link

@Pacyfik - thanks! From testing on our CI, it seems like adding --require rails_helper makes 7.0 work for us.

@Pacyfik
Copy link
Contributor

Pacyfik commented Mar 6, 2024

@Pacyfik - thanks! From testing on our CI, it seems like adding --require rails_helper makes 7.0 work for us.

That's great to hear @tmtrademarked Thanks for checking it out 🙌 I'll let you know when the fix is out so you can update knapsack_pro and remove the temporary fix.

@hoshy
Copy link

hoshy commented Mar 11, 2024

... In the meantime, could you please try running the knapsack_pro RSpec command on your CI with an additional argument, i.e. change bundle exec rake knapsack_pro:queue:rspec to bundle exec rake "knapsack_pro:queue:rspec[--require rails_helper]" See if this helps and let me know the result, please.

@Pacyfik unfortunately, that didn't help us.

@Pacyfik
Copy link
Contributor

Pacyfik commented Mar 11, 2024

Hey @Alagaesia93 @tmtrademarked @irphilli We've just published version 7.0.1 of the gem. Could you please update and let me know if your issue still persists?
If you used the workaround I mentioned in my previous comment, you can revert that.
Here's the changelog if you're interested.

Hi @hoshy I'm sorry to hear that. I'd appreciate it if you could also update your gem to 7.0.1 and check if that helps. If not, let me know and we'll investigate further and see what we can do about it.

@irphilli
Copy link

irphilli commented Mar 11, 2024

@Pacyfik The workaround (and subsequently, 7.0.1) solved the issue for me. Thank you!

@Pacyfik Pacyfik removed the wip Work in progress label Mar 14, 2024
@Alagaesia93
Copy link
Author

Hi @Pacyfik! Sorry for delay, I was off

With 7.0.1 it doesn't work for me, but it works if I do
bundle exec rake "knapsack_pro:queue:rspec[--require spec_helper]"

The app I'm managing is quite old so we have that file, not sure if you want to add that as an option. I'm also fine with keeping the bundle exec rake "knapsack_pro:queue:rspec[--require spec_helper]", maybe add to readme?

@Pacyfik
Copy link
Contributor

Pacyfik commented Mar 20, 2024

Hey @Alagaesia93 Thanks for letting me know.
I'm happy you managed to find a solution to your issue. If you can continue using it for now, that would be great.
If you can spare a few minutes, I'd be interested to know a few specifics about your app, if you can disclose them of course.
Based on the ci.yml contents you shared I assume it's a Rails application.
Could you e.g. tell me whether you have an .rspec file in your root directory (if you do, does it have a --require spec_helper line in it?), do you have a spec/rails_helper.rb file, do you require spec_helper in each of your spec files, do you use Rails engines?
I'm wondering how your RSpec is configured and how it runs without knapsack, so e.g. locally in dev env.
I'm hoping this information might help us inform our design choices and defaults for knapsack_pro.

@hoshy
Copy link

hoshy commented Mar 21, 2024

Hi @hoshy I'm sorry to hear that. I'd appreciate it if you could also update your gem to 7.0.1 and check if that helps. If not, let me know and we'll investigate further and see what we can do about it.

Hi @Pacyfik it's working on our side! Problem was that we haven't excluded some tags which causes the failures. Adding --tag ~someTag to .rspec solved the issues

@Alagaesia93
Copy link
Author

Based on the ci.yml contents you shared I assume it's a Rails application

yes

Could you e.g. tell me whether you have an .rspec file in your root directory (if you do, does it have a --require spec_helper line in it?)

I don't have it

do you have a spec/rails_helper.rb file

nope

do you require spec_helper in each of your spec files

yes

do you use Rails engines?

not sure what you mean here

I'm wondering how your RSpec is configured and how it runs without knapsack, so e.g. locally in dev env. I'm hoping this information might help us inform our design choices and defaults for knapsack_pro.

in local, bundle exec rspec, easy as that

I hope it helps!

@Pacyfik
Copy link
Contributor

Pacyfik commented Apr 10, 2024

Thanks @Alagaesia93 It seems your app has a slightly less common RSpec setup which might be explained by the age of your project. At the moment, knapsack_pro has all the current RSpec defaults covered. We will have to consider what changes to introduce to cover a wider range of custom RSpec configurations.

For now, seeing as all the people who reported the original issue with their apps, have been able to fix it, I would consider the issue resolved.
I'm always happy to continue the conversation if needed or offer any help.

@Pacyfik Pacyfik closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants