-
Notifications
You must be signed in to change notification settings - Fork 4.8k
USHIFT-348: microshift: skip and fix sig-cli tests #27389
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
Conversation
test/extended/cli/apiresources.go
Outdated
| o.Expect(out).To(o.ContainSubstring("storage.k8s.io/v1")) | ||
| }) | ||
|
|
||
| g.It("can output expected information about openshift api-resources [apigroup:build.openshift.io][apigroup:project.openshift.io][apigroup:user.openshift.io]", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this part of the change. Logically it's saying that if the API exists then it should show up in the output from api-resources, but aren't we using the same query to see if it exists that oc uses to produce its output? Is that a useful test?
I know we've said we didn't want to generally, but this feels like a case where we should say "If the cluster is MicroShift, skip" so that we can have a separate test that checks for the expected APIs when the cluster is MicroShift.
test/extended/cli/explain.go
Outdated
| {Group: "template.openshift.io", Version: "v1", Resource: "templateinstances"}, | ||
| } | ||
|
|
||
| microShiftBuiltinTypes = []schema.GroupVersionResource{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard would it be for us to put these microshift-specific tests in the microshift repo? If not now, eventually?
I know @bparees has been looking at splitting up the tests, so maybe we can be an early adopter of that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have local e2e tests? I have seen other operators do it before.
|
/hold |
8cd15c6 to
5d90fed
Compare
|
/unhold |
5d90fed to
762f389
Compare
test/extended/cli/apiresources.go
Outdated
| o.Expect(out).To(o.ContainSubstring("storage.k8s.io/v1")) | ||
| }) | ||
|
|
||
| g.It("can output expected information about openshift api-resources [apigroup:build.openshift.io][apigroup:project.openshift.io][apigroup:user.openshift.io]", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To increase the flexibility it's worth introducing new g.It for each apigroup. E.g.:
g.It("can output expected information about openshift build api-resources [apigroup:build.openshift.io]", func() {
...
}
g.It("can output expected information about openshift image api-resources [apigroup:image.openshift.io]", func() {
...
}
g.It("can output expected information about openshift project api-resources [apigroup:project.openshift.io]", func() {
...
}
g.It("can output expected information about openshift user api-resources [apigroup:user.openshift.io]", func() {
...
}
...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| o.Expect(os.Unsetenv("MYENV")).NotTo(o.HaveOccurred()) | ||
| }) | ||
|
|
||
| g.It("works as expected with cluster operators [apigroup:config.openshift.io]", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why separate when the original works as expected [apigroup:config.openshift.io] name still keeps the apigroup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
762f389 to
4106c86
Compare
| }) | ||
| } | ||
|
|
||
| for group, bts := range builtinTypes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the loop duplicated by accident or is there a reason for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builtinTypes is defined as map[string][]schema.GroupVersionResource. This loop takes the apigroup as group and the list is assigned to bts. This is passed to verifySpecStatusExplain which takes a schema.GroupVersionResource as the last argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both
for group, bts := range builtinTypes {
g.It(fmt.Sprintf("should contain spec+status for %s [apigroup:%s]", group, group), func() {
for _, bt := range bts {
o.Expect(verifySpecStatusExplain(oc, nil, bt)).NotTo(o.HaveOccurred())
}
})
}and
for group, bts := range builtinTypes {
g.It(fmt.Sprintf("should contain spec+status for %s [apigroup:%s]", group, group), func() {
for _, bt := range bts {
e2e.Logf("Checking %s...", bt)
o.Expect(verifySpecStatusExplain(oc, nil, bt)).NotTo(o.HaveOccurred())
}
})
}are identical up to `e2e.Logf("Checking %s...", bt) line unless I am overlooking something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, misunderstood you. You are absolutely right, should be fixed now.
| } | ||
| ) | ||
|
|
||
| func getCrdTypes(oc *exutil.CLI) []schema.GroupVersionResource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCrdTypes is invoked by two tests:
- "list uncovered GroupVersionResources"
- "should contain proper spec+status for CRDs [apigroup:config.openshift.io]"
The second already assumes existence of the config apigroup which is getting detected inside getCrdTypes.
getCrdTypes is always constructing the list of crd types from baseCRDTypes, autoscalingTypes, machineTypes and additionalOperatorTypes which belong to their corresponding groups as well. Which at least requires to label both tests with the corresponding groups as well. Making both tests as another place for refactoring and looping through through the apigroups.
@pacevedom this tests requires more refactoring than anticipated. Though, better to do it properly now than later/never. Nevertheless, very good progress here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"should contain proper spec+status for CRDs [apigroup:config.openshift.io]" requires config API because it checks for control plane topology in order to select different CRDs.
The nature of this test is to check explicitly for presence of those APIs that get built in getCRDTypes. If they are not present (or are poorly defined) then that should be an error. Maybe we should have a MicroShift specific test with the CRDs we install there instead? To me it is not only about checking that whatever is present is ok, it is also about specifying what should be installed.
"list uncovered GroupVersionResources" goes after API groups not covered in this file to list them. It does not perform any checks besides producing logs for those uncovered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should contain proper spec+status for CRDs [apigroup:config.openshift.io] checks presence of explanation text for corresponding CRD's spec and status.
The nature of this test is to check explicitly for presence of those APIs that get built in getCRDTypes. If they are not present (or are poorly defined) then that should be an error.
The test does not check whether a cluster has a required list of CRDs present. Unless I am missing the specific line. The test checks whether CRDs listed by getCRDTypes have the spec and status properly described when running oc explain command. I.e. testing implication (is a given crd present -> has the crd spec/status properly explained). For that the list of CRDs can still be broken down based on the apigroup and each apigroup test separately. If there's a need to explicitly check for a presence of a specific list of CRDs, new test needs to be written.
To me it is not only about checking that whatever is present is ok, it is also about specifying what should be installed.
I don't think this is the case here.
"list uncovered GroupVersionResources" goes after API groups not covered in this file to list them. It does not perform any checks besides producing logs for those uncovered.
Ack. Reading the code a second time resourceMap gets populated from what's installed on a cluster minutes what's provided by getCrdTypes. Taking my comment back. Thanks for the pointers.
0730bb9 to
e47e136
Compare
test/extended/cli/basics.go
Outdated
| TLSClientConfig: &tls.Config{ | ||
| RootCAs: rootCAs, | ||
| RootCAs: rootCAs, | ||
| Certificates: certs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pacevedom does this change automatically implies OAuth tokens will no longer be used? Is there any way to detect whether OAuth tokens are used and generate list of certs only when they are not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for having a look, this was a leftover from before all the changes to the oc project impersionation were complete. Now its not needed so I remove it.
e47e136 to
d111353
Compare
|
/retest-required |
2 similar comments
|
/retest-required |
|
/retest-required |
d111353 to
baf4c04
Compare
|
/lgtm |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ingvagabund, mfojtik, pacevedom The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest-required |
|
@pacevedom: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
Merged through #27498 |
|
@ingvagabund: Closed this PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
No description provided.