-
Notifications
You must be signed in to change notification settings - Fork 220
[release-4.12] OCPBUGS-22432: test/e2e: Don't use openshift/origin-node #992
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
[release-4.12] OCPBUGS-22432: test/e2e: Don't use openshift/origin-node #992
Conversation
Use the "openshift/tools" image from the cluster image registry instead of using the "openshift/origin-node" image pullspec in E2E tests. Before this commit, the E2E tests were inadvertently pulling the "openshift/origin-node" image from Docker Hub and getting rate-limited. The choice to use "openshift/tools" is based on a similar change here: openshift/origin@4cbb844 Follow-up to commit 167bcc2 and commit a635566. This commit fixes OCPBUGS-17359. https://issues.redhat.com/browse/OCPBUGS-17359 * test/e2e/util_test.go (buildEchoPod, buildSlowHTTPDPod): Replace the "openshift/origin-node" image pullspec with "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest".
* test/e2e/hsts_policy_test.go (TestHstsPolicyWorks): Dump events in case of test failure, using the new dumpEventsInNamespace helper. * test/e2e/util_test.go (dumpEventsInNamespace): New helper function to log all events in a namespace.
When creating a new namespace for the TestHstsPolicyWorks test, wait for
the "default" ServiceAccount and the "system:image-pullers" RoleBinding to
be provisioned in the newly created namespace before proceeding with the
test. Make a similar change for the TestMTLSWithCRLsCerts test.
Before this commit, TestHstsPolicyWorks sometimes failed because it tried
to create a pod before the ServiceAccount had been provisioned and granted
access to pull images. As a result, the test would randomly fail with the
following error:
Failed to pull image "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest": rpc error: code = Unknown desc = reading manifest
This change should prevent such failures.
Because TestMTLSWithCRLsCerts also creates a namespace and then creates
pods in this namespace, this commit makes the same change to this test as
well. Some other tests create namespaces but do not create pods in those
namespaces; those tests do not necessarily need to wait for the
ServiceAccount and RoleBinding.
Inspired by openshift/origin@877c652.
* test/e2e/client_tls_test.go (TestMTLSWithCRLs):
* test/e2e/hsts_policy_test.go (TestHstsPolicyWorks): Use the new
createNamespace helper.
* test/e2e/util_test.go (createNamespace): New helper function. Create a
namespace with the specified name, register a cleanup handler to delete the
namespace when the test finishes, wait for the "default" ServiceAccount and
"system:image-pullers" RoleBinding to be created, and return the namespace.
|
@Miciah: This pull request references Jira Issue OCPBUGS-22432, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. 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. |
| t.Fatalf("failed to create namespace: %v", err) | ||
| } | ||
| t.Cleanup(func() { | ||
| t.Logf("Dumping events in namespace %q...", name) |
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 hadn't noticed this earlier, but this log message belongs inside the if t.Failed() condition brackets. I don't think it needs to fixed in the other PRs, but do you want to fix it here and in the 4.11 backports while they are open?
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 hadn't noticed this earlier, but this log message belongs inside the
if t.Failed()condition brackets.
According to https://pkg.go.dev/testing#T.Log:
For tests, the text will be printed only if the test fails or the -test.v flag is set.
So I don't believe there's a need to add if t.Failed().
I don't think it needs to fixed in the other PRs, but do you want to fix it here and in the 4.11 backports while they are open?
Backports should be as close as possible to the original changes (though resolving conflicts sometimes necessitates some deviation). Otherwise it gets more difficult to keep track of what actually got backported to which version, and subsequent backports are more likely to encounter conflicts. If we need additional changes to this code, I'd rather open a new Jira issue, make the additional change in the main branch, and do another series of backports if necessary.
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'll leave that up to you, it's not a big deal.
|
@Miciah: all tests passed! 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. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: candita 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 |
|
/jira refresh |
|
@Miciah: This pull request references Jira Issue OCPBUGS-22432, which is valid. The bug has been moved to the POST state. 6 validation(s) were run on this bug
Requesting review from QA contact: 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. |
|
/label cherry-pick-approved |
|
@Miciah: Jira Issue OCPBUGS-22432: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-22432 has been moved to the MODIFIED state. 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. |
|
Fix included in accepted release 4.12.0-0.nightly-2023-10-27-070629 |
test/e2e: Don't use "openshift/origin-node" imageUse the "openshift/tools" image from the cluster image registry instead of using the "openshift/origin-node" image pullspec in E2E tests.
Before this change, the E2E tests were inadvertently pulling the "openshift/origin-node" image from Docker Hub and getting rate-limited.
The choice to use "openshift/tools" is based on a similar change here: openshift/origin@4cbb844
Follow-up to #410 and #451.
test/e2e/util_test.go(buildEchoPod,buildSlowHTTPDPod): Replace the "openshift/origin-node" image pullspec with "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest".TestHstsPolicyWorks: Dump events if test failstest/e2e/hsts_policy_test.go(TestHstsPolicyWorks): Dump events in case of test failure, using the newdumpEventsInNamespacehelper.test/e2e/util_test.go(dumpEventsInNamespace): New helper function to log all events in a namespace.TestHstsPolicyWorks: Wait for namespace to be provisionedWhen creating a new namespace for the
TestHstsPolicyWorkstest, wait for the "default" ServiceAccount and the "system:image-pullers" RoleBinding to be provisioned in the newly created namespace before proceeding with the test. Make a similar change for theTestMTLSWithCRLsCertstest.Before this change,
TestHstsPolicyWorkssometimes failed because it tried to create a pod before the ServiceAccount had been provisioned and granted access to pull images. As a result, the test would randomly fail with the following error:This change should prevent such failures.
Because
TestMTLSWithCRLsCertsalso creates a namespace and then creates pods in this namespace, this PR makes the same change to this test as well. Some other tests create namespaces but do not create pods in thosenamespaces; those tests do not necessarily need to wait for the ServiceAccount and RoleBinding.
Inspired by openshift/origin@877c652.
test/e2e/client_tls_test.go(TestMTLSWithCRLs):test/e2e/hsts_policy_test.go(TestHstsPolicyWorks): Use the newcreateNamespacehelper.test/e2e/util_test.go(createNamespace): New helper function. Create a namespace with the specified name, register a cleanup handler to delete the namespace when the test finishes, wait for the "default" ServiceAccount and "system:image-pullers" RoleBinding to be created, and return the namespace.This is manual cherry-pick of #970. #965 added the
getRouteHostfunction totest/e2e/util_test.go, which caused a conflict that needed manual resolution for this backport.