Skip to content

fix tests - adding missing role, increase timeout #1655

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

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ func TestReplicaSetCustomRole(t *testing.T) {
}},
Roles: []mdbv1.Role{},
},
{
Role: "MongodbAutomationAgentUserRole",
DB: "admin",
Privileges: []mdbv1.Privilege{
{
Resource: mdbv1.Resource{
AnyResource: true,
},
Actions: []string{"bypassDefaultMaxTimeMS"},
},
},
Roles: []mdbv1.Role{},
},
}
Comment on lines +74 to 87
Copy link
Collaborator

Choose a reason for hiding this comment

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

Correct me if I'm wrong, but we added this because the automation config sometimes had this role without us specifying it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No - I think this test consistently fails IIUC. It seems the last time the ci was fully green was 4 months ago: https://github.com/mongodb/mongodb-kubernetes-operator/actions/workflows/e2e.yml?query=is%3Asuccess.

It would be nice to see single test history ...

Alternatively, we can cut that agent out from the received list.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright, thanks. Feel free to resolve


_, err := setup.GeneratePasswordForUser(testCtx, user, "")
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func DeployOperator(ctx context.Context, config TestConfig, resourceName string,
return err
}

if err := wait.PollUntilContextTimeout(ctx, time.Second, 60*time.Second, true, hasDeploymentRequiredReplicas(&dep)); err != nil {
if err := wait.PollUntilContextTimeout(ctx, time.Second*2, 120*time.Second, true, hasDeploymentRequiredReplicas(&dep)); err != nil {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

looking at the recent test failures, it was due to the fact that the deployment needed a bit more than 60 seconds to stablize

2m2s        Normal    Created                   pod/mongodb-kubernetes-operator-6c5f7d74b9-6qb6m    spec.containers{mongodb-kubernetes-operator}   kubelet, kind-control-plane      Created container mongodb-kubernetes-operator                                                                                       2m2s         1       mongodb-kubernetes-operator-6c5f7d74b9-6qb6m.18194a55944214a5
61s         Warning   FailedScheduling          pod/mongodb-kubernetes-operator-57d64f66d7-9dmm5                                                   default-scheduler                0/1 nodes are available: 1 node(s) didn't match pod affinity/anti-affinity rules, 1 node(s) didn't match pod anti-affinity rules.   2m2s         3       mongodb-kubernetes-operator-57d64f66d7-9dmm5.18194a559645561a
45s         Normal    Killing                   pod/mongodb-kubernetes-operator-6c5f7d74b9-6qb6m    spec.containers{mongodb-kubernetes-operator}   kubelet, kind-control-plane      Stopping container mongodb-kubernetes-operator                                                                                      45s          1       mongodb-kubernetes-operator-6c5f7d74b9-6qb6m.18194a6763ffc4de
14s         Normal    Scheduled                 pod/mongodb-kubernetes-operator-57d64f66d7-9dmm5                                                   default-scheduler                Successfully assigned default/mongodb-kubernetes-operator-57d64f66d7-9dmm5 to kind-control-plane                                    14s          1       mongodb-kubernetes-operator-57d64f66d7-9dmm5.18194a6eb254d17d
13s         Normal    Started 

return errors.New("error building operator deployment: the deployment does not have the required replicas")
}
fmt.Println("Successfully installed the operator deployment")
Expand Down Expand Up @@ -280,6 +280,7 @@ func hasDeploymentRequiredReplicas(dep *appsv1.Deployment) wait.ConditionWithCon
if dep.Status.ReadyReplicas == *dep.Spec.Replicas {
return true, nil
}
fmt.Printf("Deployment not ready! ReadyReplicas: %d, Spec.Replicas: %d\n", dep.Status.ReadyReplicas, *dep.Spec.Replicas)
return false, nil
}
}
Loading