-
Notifications
You must be signed in to change notification settings - Fork 73
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
Runtime 15 e2e #1043
base: master
Are you sure you want to change the base?
Runtime 15 e2e #1043
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ranakan19 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 |
@@ -440,9 +440,10 @@ func (a *Awaitility) CreateNamespace(t *testing.T, name string) { | |||
func (a *Awaitility) WaitForDeploymentToGetReady(t *testing.T, name string, replicas int, criteria ...DeploymentCriteria) *appsv1.Deployment { | |||
t.Logf("waiting until deployment '%s' in namespace '%s' is ready", name, a.Namespace) | |||
deployment := &appsv1.Deployment{} | |||
err := wait.Poll(a.RetryInterval, 6*a.Timeout, func() (done bool, err error) { | |||
err := wait.PollUntilContextTimeout(context.TODO(), a.RetryInterval, 6*a.Timeout, true, func(ctx context.Context) (done bool, err error) { |
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.
Poll is deprecated
…Get, revert retryInterval
@@ -590,7 +590,7 @@ func (s *userManagementTestSuite) TestUserBanning() { | |||
t.Logf("user signup '%s' created", userSignup.Name) | |||
|
|||
// Check the UserSignup is created | |||
userSignup, err = hostAwait.WaitForUserSignup(t, userSignup.Name) | |||
userSignup, err = hostAwait.WaitForUserSignup(t, userSignup.Name, wait.UntilUserSignupHasStateLabel(toolchainv1alpha1.UserSignupStateLabelValueBanned)) |
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.
wait for Label to avoid flakiness
Since in the following lines, the test checks that usersignup now has label.
PR failure - https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/codeready-toolchain_toolchain-e2e/1043/pull-ci-codeready-toolchain-toolchain-e2e-master-e2e/1841349548585259008 - but was unable to produce locally, so added a wait for label.
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 makes sense, however we don't need lines 597-599 anymore.
@@ -365,11 +364,12 @@ func TestProxyFlow(t *testing.T) { | |||
require.NoError(t, err) | |||
err = proxyCl.Create(context.TODO(), appToCreate) | |||
|
|||
// then |
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 comment block is removed as it is no longer valid. Maintaining history here might be confusing
… into runtime_15_e2e
Quality Gate passedIssues Measures |
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.
Looks good. I left a few minor comments though.
@@ -513,7 +519,8 @@ func TestProxyFlow(t *testing.T) { | |||
// note: the actual error message is "invalid workspace request: access to workspace '%s' is forbidden" but clients make api discovery calls | |||
// that fail because in this case the api discovery calls go through the proxyWorkspaceURL which is invalid. If using oc or kubectl and you | |||
// enable verbose logging you would see Response Body: invalid workspace request: access to workspace 'proxymember2' is forbidden | |||
require.EqualError(t, err, `no matches for kind "Application" in version "appstudio.redhat.com/v1alpha1"`) | |||
|
|||
require.ErrorContains(t, err, "invalid workspace request: access to workspace 'proxymember2' is forbidden") |
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 can delete the comment above as irrelevant now.
@@ -1064,22 +1071,22 @@ func TestSpaceLister(t *testing.T) { | |||
err := proxyClDefault.Get(context.TODO(), workspaceNamespacedName, &toolchainv1alpha1.Workspace{}) | |||
|
|||
require.Error(t, err) | |||
require.True(t, k8serr.IsForbidden(err), "expected Forbidden error, got %v", err) | |||
require.ErrorContains(t, err, "user access is forbidden") |
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.
Isn't the error type is ForbiddenError anymore?
testCases := map[string]bool{ | ||
"user is not banned": false, | ||
"user is banned": true, | ||
testCases := []TestCase{ |
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 the following format instead:
tests := map[string]struct {
Banned bool
ExpectedError string
}{
"user is not banned": {
Banned: false,
ExpectedError: "invalid workspace request",
},
}
@@ -255,7 +267,7 @@ func TestProxyPublicViewer(t *testing.T) { | |||
cms := corev1.ConfigMapList{} | |||
|
|||
err = communityUserProxyClient.List(context.TODO(), &cms, client.InNamespace(sp.Status.ProvisionedNamespaces[0].Name)) | |||
require.True(t, meta.IsNoMatchError(err), "expected List ConfigMap as community user to return a NoMatch error, actual: %v", err) | |||
require.ErrorContains(t, err, testCase.expectedError) |
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 we use require.ErrorEquals()
instead?
@@ -590,7 +590,7 @@ func (s *userManagementTestSuite) TestUserBanning() { | |||
t.Logf("user signup '%s' created", userSignup.Name) | |||
|
|||
// Check the UserSignup is created | |||
userSignup, err = hostAwait.WaitForUserSignup(t, userSignup.Name) | |||
userSignup, err = hostAwait.WaitForUserSignup(t, userSignup.Name, wait.UntilUserSignupHasStateLabel(toolchainv1alpha1.UserSignupStateLabelValueBanned)) |
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 makes sense, however we don't need lines 597-599 anymore.
Changes this PR includes:
- With the changes to rest mapper that provided client for discovery information to do REST mappings, breaks the use case of checking available APIs via
k8s.io/apimachinery/pkg/api/errors.IsNotFound
andk8s.io/apimachinery/pkg/api/meta.IsNoMatchError
. This means can not directly check for those errors, but should expect server error. This only affected proxy tests and the tests now check for error contains. Can find more details in this issue- Tried to propogate the context from PollUntillContextTimeout to the api calls within the condition function but it fails with
would exceed context deadline
as the last error instead of the expectedcontext deadline exceeded
error. Please refer this comment for more details. And other PR which use the same solution of intentionally pass a separate context to api calls in the consition function.- PollUntillContextTimeout will no longer return
ErrWaitTimeout
- So replaces errTimeout checks with context deadline checks. [refer this PR for more information if needed]