Skip to content

Fix updater specs on M1#5657

Merged
deivid-rodriguez merged 2 commits intomainfrom
deivid-rodriguez/fix-updater-specs-m1
Sep 8, 2022
Merged

Fix updater specs on M1#5657
deivid-rodriguez merged 2 commits intomainfrom
deivid-rodriguez/fix-updater-specs-m1

Conversation

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

I had not been able to get all updater specs passing on my laptop. I was getting two spec failures, which I describe in each commit message, together with how I got them passing.

@deivid-rodriguez deivid-rodriguez requested a review from a team as a code owner September 8, 2022 12:29
Copy link
Copy Markdown
Contributor

@pavera pavera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Copy Markdown
Contributor

@landongrindheim landongrindheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌 Thanks for the context-filled commit messages 😍

This is the docker image platform when built with `ARGETARCH=arm64`.
Adding it to original and expected lock files fixes the following spec
failure:

```
1) Dependabot::EndToEndJob bundler git dependencies updates dependencies correctly
   Failure/Error:
     expect(files).to eq(
       [
         {
           "name" => "Gemfile",
           "content" => fixture("bundler_git/updated/Gemfile"),
           "directory" => "/",
           "type" => "file",
           "support_file" => false,
           "content_encoding" => "utf-8",
           "deleted" => false,

     expected: [{"content"=>"# frozen_string_literal: true\n\nsource \"https://rubygems.org\"\n\ngem \"dummy-git-dep...ectory"=>"/", "name"=>"Gemfile.lock", "operation"=>"update", "support_file"=>false, "type"=>"file"}]
          got: [{"content"=>"# frozen_string_literal: true\n\nsource \"https://rubygems.org\"\n\ngem \"dummy-git-dep...ectory"=>"/", "name"=>"Gemfile.lock", "operation"=>"update", "support_file"=>false, "type"=>"file"}]

     (compared using ==)

     Diff:
     @@ -8,7 +8,7 @@
        "support_file"=>false,
        "type"=>"file"},
       {"content"=>
     -   "GIT\n  remote: git@github.com:dependabot-fixtures/ruby-dummy-git-dependency.git\n  revision: c0e25c2eb332122873f73acb3b61fb2e261cfd8f\n  ref: v1.1.0\n  specs:\n    dummy-git-dependency (1.1.0)\n\nGEM\n  remote: https://rubygems.org/\n  specs:\n\nPLATFORMS\n  x86_64-darwin-19\n  x86_64-linux\n\nDEPENDENCIES\n  dummy-git-dependency!\n\nBUNDLED WITH\n   2.2.11\n",
     +   "GIT\n  remote: git@github.com:dependabot-fixtures/ruby-dummy-git-dependency.git\n  revision: c0e25c2eb332122873f73acb3b61fb2e261cfd8f\n  ref: v1.1.0\n  specs:\n    dummy-git-dependency (1.1.0)\n\nGEM\n  remote: https://rubygems.org/\n  specs:\n\nPLATFORMS\n  aarch64-linux\n  x86_64-darwin-19\n\nDEPENDENCIES\n  dummy-git-dependency!\n\nBUNDLED WITH\n   2.2.11\n",
        "content_encoding"=>"utf-8",
        "deleted"=>false,
        "directory"=>"/",
   # ./spec/dependabot/integration_spec.rb:331:in `block (4 levels) in <top (required)>'
   # ./lib/dependabot/service.rb:22:in `create_pull_request'
   # ./lib/dependabot/updater.rb:736:in `create_pull_request'
   # ./lib/dependabot/updater.rb:307:in `check_and_create_pull_request'
   # ./lib/dependabot/updater.rb:102:in `check_and_create_pr_with_error_handling'
   # ./lib/dependabot/updater.rb:73:in `block in run'
   # ./lib/dependabot/updater.rb:73:in `each'
   # ./lib/dependabot/updater.rb:73:in `run'
   # ./lib/dependabot/end_to_end_job.rb:26:in `perform_job'
   # ./lib/dependabot/base_job.rb:50:in `run'
   # ./spec/dependabot/integration_spec.rb:357:in `block (3 levels) in <top (required)>'
   # ./vendor/ruby/2.7.0/gems/webmock-3.17.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
```
At least when run in isolation, nothing seems to require
`dependabot/instrumentation`, since only entrypoints like
`bin/fetch_files.rb`, `bin/update_files.rb` and `bin/dry-run.rb`
require `dependabot/setup`, which in turn requires this file. So, the
package manager does not get instrumented and the following spec
failure happens:

```
Failures:

1) Dependabot::EndToEndJob bundler instruments the package manager version
   Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
     Exactly one instance should have received the following message(s) but didn't: record_package_manager_version
   # ./vendor/ruby/2.7.0/gems/rspec-support-3.11.0/lib/rspec/support.rb:102:in `block in <module:Support>'
   # ./vendor/ruby/2.7.0/gems/rspec-support-3.11.0/lib/rspec/support.rb:111:in `notify_failure'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks/error_generator.rb:327:in `notify'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks/error_generator.rb:311:in `__raise'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks/any_instance/error_generator.rb:7:in `raise_second_instance_received_message_error'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks/any_instance/recorder.rb:100:in `verify'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks/space.rb:75:in `block in verify_all'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks/space.rb:75:in `each_value'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks/space.rb:75:in `verify_all'
   # ./vendor/ruby/2.7.0/gems/rspec-mocks-3.11.0/lib/rspec/mocks.rb:45:in `verify'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/mocking_adapters/rspec.rb:23:in `verify_mocks_for_rspec'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:525:in `verify_mocks'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:519:in `run_after_example'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:283:in `block in run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:486:in `block in run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
   # ./vendor/ruby/2.7.0/gems/webmock-3.17.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:457:in `instance_exec'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:390:in `execute_with'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:352:in `call'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/hooks.rb:486:in `run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example.rb:259:in `run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:646:in `block in run_examples'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:642:in `map'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:642:in `run_examples'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:607:in `run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `block in run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `map'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/example_group.rb:608:in `run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `map'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/configuration.rb:2068:in `with_suite_hooks'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:116:in `block in run_specs'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/reporter.rb:74:in `report'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:115:in `run_specs'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:89:in `run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:71:in `run'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/lib/rspec/core/runner.rb:45:in `invoke'
   # ./vendor/ruby/2.7.0/gems/rspec-core-3.11.0/exe/rspec:4:in `<top (required)>'
   # ./vendor/ruby/2.7.0/bin/rspec:23:in `load'
   # ./vendor/ruby/2.7.0/bin/rspec:23:in `<top (required)>'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/cli/exec.rb:58:in `load'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/cli/exec.rb:58:in `kernel_load'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/cli/exec.rb:23:in `run'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/cli.rb:483:in `exec'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/cli.rb:31:in `dispatch'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/cli.rb:25:in `start'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/exe/bundle:48:in `block in <top (required)>'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
   # /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.14/exe/bundle:36:in `<top (required)>'
   # .bundle/bin/bundle:113:in `load'
   # .bundle/bin/bundle:113:in `<main>'
```

Add an explicit require to fix the issue.
@deivid-rodriguez deivid-rodriguez force-pushed the deivid-rodriguez/fix-updater-specs-m1 branch from 8cf626d to b11bb51 Compare September 8, 2022 14:24
@deivid-rodriguez
Copy link
Copy Markdown
Contributor Author

Thank you! ❤️

@deivid-rodriguez deivid-rodriguez merged commit 770d29c into main Sep 8, 2022
@deivid-rodriguez deivid-rodriguez deleted the deivid-rodriguez/fix-updater-specs-m1 branch September 8, 2022 14:27
@pavera pavera mentioned this pull request Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants