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

[POOL-606] oc-chef-pedant: improve oc_id API test coverage #1289

Merged
merged 3 commits into from
Jun 7, 2017

Conversation

srenatus
Copy link
Contributor

@srenatus srenatus commented Jun 2, 2017

This does not involve controllers/routes that:

a) send an email (we can't do that on prem)
b) require an existing oauth2 application
c) zendesk

Profile update does not include the email address because this, too,
would send an email.

srenatus added 2 commits June 2, 2017 14:31
This does not involve controllers/routes that:

a) send an email (we can't do that on prem)
b) require an existing oauth2 application
c) zendesk

Profile update does not include the email address because this, too,
would send an email.

Signed-off-by: Stephan Renatus <[email protected]>
Signed-off-by: Stephan Renatus <[email protected]>
Copy link
Member

@marcparadise marcparadise 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.


# create user before each test so that we don't regen the keys
# of the standard user used in other tests.
let(:oc_id_user) { platform.create_user(username, user_overrides) }
Copy link
Member

Choose a reason for hiding this comment

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

nit: Could we do this as shared(:oc_id_user) and clean it up in an after(:all)? Disregard if the tests change user record state in a way that would affect other tests. It's not a huge deal, I'm just hoping to avoid increasing overall pedant time where it can be done safely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool. I didn't know how to do that. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

I've taken a stab at doing this but it gets a bit ugly to be honest since: (1) As far as I can tell shared isn't a thing, so you need to use instance variables in a before block and (2) we have at least 3 tests that change the user-object. We can order those tests precisely so they don't conflict, but I think it is just best to eat the extra tests for now.

Copy link
Member

Choose a reason for hiding this comment

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

That works for now. shared is a pedant thing that's hiding somewhere in our libs. Semantically similar to let but less robust for overriding iirc, and it persists across examples so that they can be accessed for setup in before/after :all blocks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm, perhaps we've broken it then, because it super-duper didn't work right for me. BUT, it could be that I was actually hitting some of the data interactions.

@@ -2,6 +2,38 @@
require 'openssl'

Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to include a comment specifying endpoints that exist but are not covered, with a reference to the unit coverage? The possible down side is remembering to update that when it changes - but Id endpoints are relatively static.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 can do. It makes sense to not only have that information in the Jira ticket, but also where you might want to see it. 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

I added a new untested_endpoint method that we can use to document issues like this.

Copy link
Contributor

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

Addressed some of the comments. @marcparadise Let me know what you think regarding the user creation. I have a single-user setup working locally, it is just a bit ugly.

@@ -387,6 +387,16 @@ def self.isolate(message = nil, &examples)
end
end

# Used to easily documented endpoints that don't have tests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

💯 good idea

@marcparadise marcparadise merged commit f56bded into master Jun 7, 2017
@marcparadise marcparadise deleted the sr/pool-606/oc-id-api-coverage-in-pedant branch June 7, 2017 15:51
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