Skip to content

Commit 6acec25

Browse files
authored
fix tests - adding missing role, increase timeout (mongodb#1655)
* fix test by adding the missing role * bump timeout - sometimes the operator is not starting up in time
1 parent 097e13b commit 6acec25

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

test/e2e/replica_set_custom_role/replica_set_custom_role_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ func TestReplicaSetCustomRole(t *testing.T) {
7171
}},
7272
Roles: []mdbv1.Role{},
7373
},
74+
{
75+
Role: "MongodbAutomationAgentUserRole",
76+
DB: "admin",
77+
Privileges: []mdbv1.Privilege{
78+
{
79+
Resource: mdbv1.Resource{
80+
AnyResource: true,
81+
},
82+
Actions: []string{"bypassDefaultMaxTimeMS"},
83+
},
84+
},
85+
Roles: []mdbv1.Role{},
86+
},
7487
}
7588

7689
_, err := setup.GeneratePasswordForUser(testCtx, user, "")

test/e2e/setup/setup.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func DeployOperator(ctx context.Context, config TestConfig, resourceName string,
237237
return err
238238
}
239239

240-
if err := wait.PollUntilContextTimeout(ctx, time.Second, 60*time.Second, true, hasDeploymentRequiredReplicas(&dep)); err != nil {
240+
if err := wait.PollUntilContextTimeout(ctx, time.Second*2, 120*time.Second, true, hasDeploymentRequiredReplicas(&dep)); err != nil {
241241
return errors.New("error building operator deployment: the deployment does not have the required replicas")
242242
}
243243
fmt.Println("Successfully installed the operator deployment")
@@ -280,6 +280,7 @@ func hasDeploymentRequiredReplicas(dep *appsv1.Deployment) wait.ConditionWithCon
280280
if dep.Status.ReadyReplicas == *dep.Spec.Replicas {
281281
return true, nil
282282
}
283+
fmt.Printf("Deployment not ready! ReadyReplicas: %d, Spec.Replicas: %d\n", dep.Status.ReadyReplicas, *dep.Spec.Replicas)
283284
return false, nil
284285
}
285286
}

0 commit comments

Comments
 (0)