-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Bug 1992596: e2e/cli: Move annotations.sh and basicresources.sh to proper e2e #26415
Bug 1992596: e2e/cli: Move annotations.sh and basicresources.sh to proper e2e #26415
Conversation
@deejross: This pull request references Bugzilla bug 1992596, which is valid. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
Requesting review from QA contact: In 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. |
/assign @atiratree |
/retest-required |
test/extended/cli/annotation.go
Outdated
|
||
var ( | ||
ctx = context.Background() | ||
oc = exutil.NewCLI("oc-annotation").AsAdmin() |
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 think we probably don't need an admin privileges here. Can you check the other tests as well?
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.
This was required for getting node information
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.
yup, keep it in places where you need it
test/extended/cli/resources.go
Outdated
return k8simage.GetE2EImage(k8simage.BusyBox) | ||
} | ||
|
||
func getNginxImage() string { |
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 it necessary to wrap these?
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.
Was trying to avoid an additional import in the compat.go
file, but if that's not a concern I can remove these.
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.
IMO that is not a big concern
test/extended/cli/resources.go
Outdated
return k8simage.GetE2EImage(k8simage.Nginx) | ||
} | ||
|
||
func newCreateOptions() metav1.CreateOptions { |
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.
this seems too superfluous as well
test/extended/cli/compat.go
Outdated
o.Expect(err).NotTo(o.HaveOccurred()) | ||
}) | ||
|
||
g.It("can ensure the probe command is functioning as expected on pods", 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.
a lot of these seem quite specific and they could look better in separate files. Can you move these usecases to a separate PR as this one got quite big already? It would be easier to review/merge.
test/extended/cli/compat.go
Outdated
o.Expect(err).NotTo(o.HaveOccurred()) | ||
}) | ||
|
||
g.It("can create deploymentconfig and clusterquota", 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.
we could have a special test for cluster quota that also verifies the quotas
test/extended/cli/compat.go
Outdated
o.Expect(out).To(o.ContainSubstring("updated")) | ||
}) | ||
|
||
g.It("can ensure the expose command is functioning as expected", 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.
this could be under services or expose file
test/extended/cli/resources.go
Outdated
|
||
func newMixedAPIVersionsFile() string { | ||
// this was converted from YAML to JSON to prevent indentation formatting issues | ||
var body = ` |
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.
what is the benefit of this? Keeping these in files has a better readability IMO.
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.
Since most of the tests are required to run in disconnected environments, using images directly in these files won't work when converted to Go. The appropriate e2e images need to be used instead, which is what the string replacement handles before writing this out to a temporary file. I didn't want to modify a file already under version control during testing.
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.
- you can do a similar thing with files to what you do in your function. 1. load file 2. replace images. 3 save to tmp file. Then we can version control them directly as yaml files.
- I also noticed some of the yamls don't include images so you can use them directly as files
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.
@deejross Can you please cleanup the commits a bit so there is not the whole history of changes but only the commits specific to this PR?
test/extended/cli/rsync.go
Outdated
g.By("Verifying original file is in the local directory") | ||
o.Expect(foundOriginal).To(o.BeTrue()) | ||
|
||
g.By("Verifying renamed file is not in the local directory") | ||
o.Expect(foundModified).To(o.BeFalse()) | ||
|
||
g.By("Getting an error if copying to a destination directory where there is no write permission") | ||
result, err = oc.Run("rsync").Args( | ||
_, err = oc.Run("rsync").Args( |
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.
Execute can be used here instead
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.
This still holds.
test/extended/cli/resources.go
Outdated
Name: "testapp", | ||
Image: k8simage.GetE2EImage(k8simage.BusyBox), | ||
Command: []string{"/bin/sleep"}, | ||
Args: []string{"300"}, |
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.
this might be a small timeout for some tests, maybe better to use httpd which does not timeout?
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.
or some kind of nginx
test/extended/cli/statefulset.go
Outdated
|
||
g.It("creates and deletes statefulsets", func() { | ||
g.By("creating a new service for the statefulset") | ||
_, err := oc.KubeClient().CoreV1().Services(oc.Namespace()).Create( |
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 think it is better to use oc CLI client since it is the purpose of these tests
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.
Yes please.
test/extended/cli/statefulset.go
Outdated
|
||
var ( | ||
ctx = context.Background() | ||
oc = exutil.NewCLI("oc-statefulset").AsAdmin() |
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 think we should not require an admin here
test/extended/cli/secret.go
Outdated
var ( | ||
oc = exutil.NewCLI("oc-secret").AsAdmin() | ||
testData = exutil.FixturePath("testdata", "cmd", "test", "cmd", "testdata") | ||
resourceBuilder = filepath.Join(testData, "resource-builder") |
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.
it is not necessary to have testData variable if it is not reused IMO. Also resourceBuilder needs a better naming like resourceBuilderDir or path so its usage is more apparent
test/extended/cli/secret.go
Outdated
defer g.GinkgoRecover() | ||
|
||
var ( | ||
oc = exutil.NewCLI("oc-secret").AsAdmin() |
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.
admin
test/extended/cli/secret.go
Outdated
o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
||
g.By("getting secrets without extensions") | ||
_, err = oc.Run("get").Args("secret", "json-no-extension", "yml-no-extension").Output() |
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.
you can use Execute
in these
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.
Ditto.
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var _ = g.Describe("[sig-cli] oc service", 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.
mentioned remarks apply to this file as well
@@ -1,327 +0,0 @@ | |||
#!/bin/bash |
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.
please only remove the lines and files that apply to this PR
/bugzilla refresh The requirements for Bugzilla bugs have changed, recalculating validity. |
@openshift-merge-robot: This pull request references Bugzilla bug 1992596, which is invalid:
Comment In 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. |
/bugzilla refresh |
@deejross: This pull request references Bugzilla bug 1992596, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: In 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. |
fbd9a0e
to
7a95488
Compare
@deejross: This pull request references Bugzilla bug 1992596, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: In 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. |
f572091
to
6b4685e
Compare
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.
A couple of nits, but most importantly you forgot to run make update
to regenerate annotations.
test/extended/cli/statefulset.go
Outdated
defer g.GinkgoRecover() | ||
|
||
var ( | ||
oc = exutil.NewCLI("oc-statefulset") |
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.
Nit: for single vars it's fine to just do
oc := exutil.NewCLI("oc-statefulset")
test/extended/cli/status.go
Outdated
defer g.GinkgoRecover() | ||
|
||
var ( | ||
oc = exutil.NewCLI("oc-status") |
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.
Same here wrt oc := exutil.NewCLI("oc-status")
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.
@deejross can you please only remove the relevant lines as mentioned?(#26415 (comment)). This will help us to continue atomically in the next PR
o.Expect(err).NotTo(o.HaveOccurred()) | ||
defer os.Remove(statefulSetFile) | ||
|
||
err = oc.Run("create").Args("-f", frontendFile).Execute() |
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.
btw you can also use InputString
to read the data from stdin instead of a file
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.
also can you please use the oc CLI client instead of an direct API calls in other places as well?
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.
those can be done in followups
4f3c255
to
4daa813
Compare
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deejross, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@deejross: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest-required Please review the full test history for this PR and help us cut down flakes. |
@deejross: All pull requests linked via external trackers have merged: Bugzilla bug 1992596 has been moved to the MODIFIED state. In 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. |
/cherry-pick release-4.9 |
1 similar comment
/cherry-pick release-4.9 |
@hardys: new pull request created: #26738 In 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. |
Backporting this should resolve https://bugzilla.redhat.com/show_bug.cgi?id=1998963 I think since it removes the hard-coded busybox image reference |
There is a lot in
basicresources.sh
including non-resource and multi-resource tests. This PR is moving that logic out of the old bash script and into Go tests, while appropriately organizing them.