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

Add api specs for prometheus endpoints #295

Merged
merged 2 commits into from
Jan 23, 2018

Conversation

zeari
Copy link

@zeari zeari commented Jan 21, 2018

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1535941
spec tests for ManageIQ/manageiq-providers-kubernetes#220

This wont catch the regression handled in ManageIQ/manageiq-providers-kubernetes#220 but we rely on api too much for us not to have at least some prometheus spec tests here.

@elad661 @cben @moolitayer PTAL

@zeari
Copy link
Author

zeari commented Jan 21, 2018

@miq-bot add_label providers/containers

Copy link
Contributor

@elad661 elad661 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

@elad661
Copy link
Contributor

elad661 commented Jan 21, 2018

I know you're not touching that part in the file, but I don't like the fact that we have security_protocol with values that makes no sense in some of those tests. I'll send a PR to our provider to reject those, so can you also change those values to something that makes sense while you're at it?

@miq-bot
Copy link
Member

miq-bot commented Jan 21, 2018

Checked commits zeari/manageiq-api@9369980~...6454bd2 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍪

prometheus_alerts_connection["endpoint"]
)
expect(provider.authentication_token(:prometheus)).to eq(token(prometheus_connection))
expect(provider.authentication_token(:prometheus_alerts)).to eq(token(prometheus_alerts_connection))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this tested what we wanted to test.
AFAICT it only checks parent endpoints got created correctly; we mainly want to test child manager got created (and can see the endpoint it needs).

Consider also adding test for deletion of prometheus endpoint and maybe of whole provider resulting in child manager deletion.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cben testing the child manager got created should probably not be done in the API tests. If I understand correctly, API tests are supposed to test the interface, not the implementation, and the child manager is definitely an implementation detail.

Copy link
Author

Choose a reason for hiding this comment

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

I was thinking of it doesnt blow up type tests

Should the sub-manager logic go away(which i feel it might) then we will need to change these spec tests so endpoint creation is enough IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

API tests are supposed to test the interface, not the implementation, and the child manager is definitely an implementation detail.

Well, I really want an integration test that implementation reacted correctly to API somewhere.
Do you see a better place/way to test it?
OK, in principle, if we have a test in our repo that directly creating parent endpoint creates the child (do we?), and test that API creates endpoints, then in theory we're covered. I have low trust for theory in this case though :-)

I was thinking of it doesnt blow up type tests

Hmm, yes, for this specific failure it was blowing up, that's enough.

@zeari
Copy link
Author

zeari commented Jan 22, 2018

I know you're not touching that part in the file, but I don't like the fact that we have security_protocol with values that makes no sense in some of those tests. I'll send a PR to our provider to reject those, so can you also change those values to something that makes sense while you're at it?

Changed to "ssl-without-validation"

@zeari
Copy link
Author

zeari commented Jan 23, 2018

@abellotti Please review

@abellotti
Copy link
Member

I think this is fine, testing what the inbound API request is supposed to do. Not sure if there are additional provider wiring tests to do for this scenario, but that may be best in the provider repo.

So, I'm 👍 here. /cc @jntullo thoughts ?

@abellotti abellotti self-assigned this Jan 23, 2018
Copy link

@jntullo jntullo left a comment

Choose a reason for hiding this comment

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

LGTM! I like this because the specs can act as a good reference to how different providers can be created. 👍

@abellotti abellotti added this to the Sprint 78 Ending Jan 29, 2018 milestone Jan 23, 2018
@abellotti abellotti added the test label Jan 23, 2018
@abellotti abellotti merged commit fb3a844 into ManageIQ:master Jan 23, 2018
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.

6 participants