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

Fix failing EmsContainerControllerSpec #7051

Merged
merged 1 commit into from
May 18, 2020

Conversation

mzazrivec
Copy link
Contributor

Fixing the following failure:

1) EmsContainerController.update_ems_button_detect with route set detects openshift prometheus alert route
     Failure/Error: expect(mock_client).to receive(:discover)
     
       (Double "kubeclient").discover(*(any args))
           expected: 1 time with any arguments
           received: 2 times with any arguments
     # ./spec/controllers/ems_container_controller_spec.rb:74:in `block (4 levels) in <top (required)>'
  2) EmsContainerController.update_ems_button_detect with route set tolerates detection exceptions
     Failure/Error: expect(mock_client).to receive(:discover)
     
       (Double "kubeclient").discover(*(any args))
           expected: 1 time with any arguments
           received: 2 times with any arguments
     # ./spec/controllers/ems_container_controller_spec.rb:74:in `block (4 levels) in <top (required)>'
  3) EmsContainerController.update_ems_button_detect with route set detects openshift prometheus metric route
     Failure/Error: expect(mock_client).to receive(:discover)
     
       (Double "kubeclient").discover(*(any args))
           expected: 1 time with any arguments
           received: 2 times with any arguments
     # ./spec/controllers/ems_container_controller_spec.rb:74:in `block (4 levels) in <top (required)>'
  4) EmsContainerController.update_ems_button_detect with route set detects openshift hawkular metric route
     Failure/Error: expect(mock_client).to receive(:discover)
     
       (Double "kubeclient").discover(*(any args))
           expected: 1 time with any arguments
           received: 2 times with any arguments
     # ./spec/controllers/ems_container_controller_spec.rb:74:in `block (4 levels) in <top (required)>'

@mzazrivec mzazrivec added the test label May 18, 2020
@skateman skateman self-assigned this May 18, 2020
@@ -71,7 +71,7 @@
EvmSpecHelper.create_guid_miq_server_zone
# set kubeclient to return a mock route.
allow(Kubeclient::Client).to receive(:new).and_return(mock_client)
expect(mock_client).to receive(:discover)
expect(mock_client).to receive(:discover).twice
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather go with:

Suggested change
expect(mock_client).to receive(:discover).twice
expect(mock_client).to receive(:discover).at_least(:once)

as this is a mock and the amount of discover might change in the future.

Copy link
Member

Choose a reason for hiding this comment

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

Also if we're using allow above, it's pointless to have an expect here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@mzazrivec mzazrivec force-pushed the fix_failing_ems_container_spec branch from 0b776e7 to e9c12b2 Compare May 18, 2020 11:44
@miq-bot
Copy link
Member

miq-bot commented May 18, 2020

Checked commit mzazrivec@e9c12b2 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. ⭐

Copy link
Member

@skateman skateman left a comment

Choose a reason for hiding this comment

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

The Seal of Approval

@skateman skateman merged commit 81d4bdd into ManageIQ:master May 18, 2020
@mzazrivec mzazrivec deleted the fix_failing_ems_container_spec branch May 18, 2020 12:17
simaishi pushed a commit that referenced this pull request May 20, 2020
Fix failing EmsContainerControllerSpec

(cherry picked from commit 81d4bdd)
@simaishi
Copy link
Contributor

Jansa backport details:

$ git log -1
commit ffec492ccc3f5f7fa094a1a180f0c9f7231cc5c7
Author: Halász Dávid <[email protected]>
Date:   Mon May 18 14:06:06 2020 +0200

    Merge pull request #7051 from mzazrivec/fix_failing_ems_container_spec

    Fix failing EmsContainerControllerSpec

    (cherry picked from commit 81d4bdd8f2986de4888e5964c8b6550e7e5ba2e0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants