Skip to content

Commit

Permalink
Put an eventually in place since this update is failing on some optim…
Browse files Browse the repository at this point in the history
…istic locking issue.
  • Loading branch information
Miles-Garnsey committed Apr 5, 2024
1 parent fbbc63c commit c0a8992
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions controllers/k8ssandra/add_dc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,32 +744,39 @@ func addStargateAndReaperToCluster(ctx context.Context, t *testing.T, f *framewo
}

func addDcToCluster(ctx context.Context, t *testing.T, f *framework.Framework, kc *api.K8ssandraCluster, dcKey framework.ClusterKey) {
t.Logf("add %s to cluster", dcKey.Name)
require.Eventually(t, func() bool {
t.Logf("add %s to cluster", dcKey.Name)

key := utils.GetKey(kc)
err := f.Client.Get(ctx, key, kc)
require.NoError(t, err, "failed to get K8ssandraCluster")
key := utils.GetKey(kc)
err := f.Client.Get(ctx, key, kc)
require.NoError(t, err, "failed to get K8ssandraCluster")

kc.Spec.Cassandra.Datacenters = append(kc.Spec.Cassandra.Datacenters, api.CassandraDatacenterTemplate{
Meta: api.EmbeddedObjectMeta{
Name: dcKey.Name,
Namespace: dcKey.Namespace,
},
K8sContext: dcKey.K8sContext,
Size: 3,
DatacenterOptions: api.DatacenterOptions{
ServerVersion: "4.0.1",
StorageConfig: &cassdcapi.StorageConfig{
CassandraDataVolumeClaimSpec: &corev1.PersistentVolumeClaimSpec{
StorageClassName: &defaultStorageClass,
kc.Spec.Cassandra.Datacenters = append(kc.Spec.Cassandra.Datacenters, api.CassandraDatacenterTemplate{
Meta: api.EmbeddedObjectMeta{
Name: dcKey.Name,
Namespace: dcKey.Namespace,
},
K8sContext: dcKey.K8sContext,
Size: 3,
DatacenterOptions: api.DatacenterOptions{
ServerVersion: "4.0.1",
StorageConfig: &cassdcapi.StorageConfig{
CassandraDataVolumeClaimSpec: &corev1.PersistentVolumeClaimSpec{
StorageClassName: &defaultStorageClass,
},
},
},
},
})
annotations.AddAnnotation(kc, api.DcReplicationAnnotation, fmt.Sprintf(`{"%s": {"ks1": 3, "ks2": 3}}`, dcKey.Name))
})
annotations.AddAnnotation(kc, api.DcReplicationAnnotation, fmt.Sprintf(`{"%s": {"ks1": 3, "ks2": 3}}`, dcKey.Name))

err = f.Client.Update(ctx, kc)
if err != nil {
t.Logf("failed to add %s to cluster: %v", dcKey.Name, err)
return false
}
return err == nil
}, timeout, interval)

err = f.Client.Update(ctx, kc)
require.NoError(t, err, "failed to add dc to K8ssandraCluster")
}

func verifyReplicationOfSystemKeyspacesUpdated(t *testing.T, mockMgmtApi *testutils.FakeManagementApiFacade, replication, updatedReplication map[string]int) {
Expand Down

0 comments on commit c0a8992

Please sign in to comment.