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

rspec 3.10 breaks unit tests #10817

Closed
tas50 opened this issue Jan 4, 2021 · 6 comments
Closed

rspec 3.10 breaks unit tests #10817

tas50 opened this issue Jan 4, 2021 · 6 comments
Assignees
Labels
Aspect: Testing Does the project have good coverage, and is CI working? Type: Breaking Change Changes the way existing features work in a way that affects users.

Comments

@tas50
Copy link
Contributor

tas50 commented Jan 4, 2021

Failures:

  1) Chef::Knife::SupermarketShare run when the --dry-run flag is specified should list files in the tarball
     Failure/Error: allow(@knife).to receive_message_chain(:shell_out!, :stdout).and_return("file")

     ArgumentError:
       Cannot proxy frozen objects, rspec-mocks relies on proxies for method stubbing and expectations.
     # ./spec/unit/knife/supermarket_share_spec.rb:143:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:305:in `block (2 levels) in <top (required)>'

  2) Chef::Knife::SupermarketShare run when the --dry-run flag is specified does not upload the cookbook
     Failure/Error: allow(@knife).to receive_message_chain(:shell_out!, :stdout).and_return("file")

     ArgumentError:
       Cannot proxy frozen objects, rspec-mocks relies on proxies for method stubbing and expectations.
     # ./spec/unit/knife/supermarket_share_spec.rb:143:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:305:in `block (2 levels) in <top (required)>'

Finished in 0.83307 seconds (files took 3.96 seconds to load)
16 examples, 2 failures

Failed examples:

rspec ./spec/unit/knife/supermarket_share_spec.rb:146 # Chef::Knife::SupermarketShare run when the --dry-run flag is specified should list files in the tarball
rspec ./spec/unit/knife/supermarket_share_spec.rb:153 # Chef::Knife::SupermarketShare run when the --dry-run flag is specified does not upload the cookbook
@tas50 tas50 added Status: Untriaged An issue that has yet to be triaged. Aspect: Testing Does the project have good coverage, and is CI working? Status: Sustaining Backlog and removed Status: Untriaged An issue that has yet to be triaged. labels Jan 4, 2021
@snehaldwivedi snehaldwivedi self-assigned this Jan 5, 2021
@snehaldwivedi
Copy link
Contributor

@tas50 I have tried running RSpec on ubuntu and on windows with the latest code with rspec (3.10.0) but I am not getting the above failures. Everything is working fine for me.

Run options:
  include {:focus=>true}
  exclude {:provider=>#<Proc: ./spec/spec_helper.rb:213>, :arch=>#<Proc: ./spec/spec_helper.rb:207>, :pwsh_installed=>true, :requires_ifconfig=>true, :choco_installed=>true, :ruby=>"2.7.0", :chef=>"17.0.31", :not_intel_64bit=>true, :rhel_gte_8=>true, :rhel8=>true, :rhel7=>true, :rhel6=>true, :rhel=>true, :not_wpar=>true, :broken=>true, :openssl_lt_101=>true, :requires_root_or_running_windows=>true, :requires_root=>true, :selinux_only=>true, :opensuse=>true, :suse_only=>true, :aix_only=>true, :system_windows_service_gem_only=>true, :solaris_only=>true, :windows_service_requires_assign_token=>true, :windows_domain_joined_only=>true, :windows_powershell_dsc_only=>true, :ruby32_only=>true, :windows_gte_10=>true, :windows32_only=>true, :windows64_only=>true, :win2012r2_only=>true, :macos_gte_1014=>true, :macos_1013=>true, :macos_only=>true, :windows_only=>true, :volatile_from_verify=>false, :volatile=>true, :external=>true}

All examples were filtered out; ignoring {:focus=>true}
..Making tarball cookbook_name.tgz
Upload complete
.Making tarball cookbook_name.tgz
Upload complete
..Making tarball cookbook_name.tgz
Upload complete
..Making tarball cookbook_name.tgz
Upload complete
.Making tarball cookbook_name.tgz
.Making tarball cookbook_name.tgz
Upload complete
.Making tarball cookbook_name.tgz
Not uploading cookbook_name.tgz due to --dry-run flag.
file
.Making tarball cookbook_name.tgz
Not uploading cookbook_name.tgz due to --dry-run flag.
file
.....

Finished in 0.71415 seconds (files took 3.71 seconds to load)
16 examples, 0 failures

Please let me know if I am missing something?

@tas50
Copy link
Contributor Author

tas50 commented Jan 6, 2021

Here's a PR updating inspec/rspec where you can see the rspec-mocks failure: https://buildkite.com/chef-oss/chef-chef-master-verify/builds/7556#9b401be3-242c-46f0-ba43-617cfe72a8c0/90-1023

@tas50
Copy link
Contributor Author

tas50 commented Jan 12, 2021

@snehaldwivedi Do we have an update on this issue?

@snehaldwivedi
Copy link
Contributor

@tas50 I have replicated this issue by using rspec 3.10.1. I need to check the parameters for this command by running it to stub this request properly. So I am studying about the stove to use share a cookbook on supermarket using this command.

@tas50
Copy link
Contributor Author

tas50 commented Feb 1, 2021

Fixed by @lamont-granquist in #10959

@tas50 tas50 closed this as completed Feb 1, 2021
@tas50 tas50 added Type: Breaking Change Changes the way existing features work in a way that affects users. and removed Status: Sustaining Backlog labels Apr 22, 2021
@tas50
Copy link
Contributor Author

tas50 commented Apr 22, 2021

1 day engineering effort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aspect: Testing Does the project have good coverage, and is CI working? Type: Breaking Change Changes the way existing features work in a way that affects users.
Projects
None yet
Development

No branches or pull requests

2 participants