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: add an override for Job in cluster resource discovery #696

Merged
merged 2 commits into from
Feb 24, 2020
Merged

fix: add an override for Job in cluster resource discovery #696

merged 2 commits into from
Feb 24, 2020

Conversation

sco11morgan
Copy link
Contributor

What are you trying to accomplish with this PR?
...
fix the error no matches for kind "Job" in version "batch/v2alpha1" #687

How is this accomplished?
adding an override for Job in cluster resource discovery

What could go wrong?
...

@sco11morgan
Copy link
Contributor Author

@dturn any idea why buildkite isn't kicking off for my PR?

@dturn
Copy link
Contributor

dturn commented Feb 18, 2020

@dturn any idea why buildkite isn't kicking off for my PR?

For security reasons, a Shopify employee has to manually trigger it on PRs from external contributors. Thanks for the ping, I'll kick it off shortly.

@dturn
Copy link
Contributor

dturn commented Feb 18, 2020

Test passed, the red x is due to a CI limitation on our side.

Copy link
Contributor

@dturn dturn left a comment

Choose a reason for hiding this comment

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

This previously passed our tests because we don't have many alpha resources.

@@ -50,7 +50,7 @@ def test_prunable_namespaced_resources
kinds = crd.prunable_resources(namespaced: true)

assert_equal(kinds.length, 25)
%w(ConfigMap CronJob Deployment).each do |expected_kind|
%w(ConfigMap CronJob Deployment batch/v1/Job).each do |expected_kind|
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this just be "Job"? Otherwise of course L54 will only ever find one matching entry, before or after this PR. I guess the matcher needs to get more specific than just include? since it will also match "CronJob".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KnVerey the point of the test is to assert that the version override is working and a specific Job API is returned ("v1" not v1beta1 or v2alpha1)

Copy link
Contributor

Choose a reason for hiding this comment

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

@sco11morgan The name of this test is vague, it was originally designed to ensure that a few obvious Kinds were present. How would you feel about adding an additional block to test for full group/version/kind matches:

%w(batch/v1/Job batch/v1beta1/cronjob).each do |expected_gvk|
  assert kinds.include?(expected_gvk)
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 moved the assertions to its own test

@sco11morgan sco11morgan requested a review from a team as a code owner February 23, 2020 14:24
@dturn dturn requested a review from KnVerey February 24, 2020 17:15
@dturn dturn merged commit 9244b34 into Shopify:master Feb 24, 2020
KnVerey pushed a commit that referenced this pull request Apr 13, 2020
* fix: add an override for Job in cluster resource discovery

* separate assertions for group/version/kind overrides
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.

None yet

3 participants