Skip to content

Commit

Permalink
Additional tests to ensure that DC added/removed returns false when i…
Browse files Browse the repository at this point in the history
…t should.
  • Loading branch information
Miles-Garnsey committed Oct 4, 2024
1 parent 7f38e21 commit 50432b1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apis/k8ssandra/v1alpha1/k8ssandracluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,32 @@ func TestGenerationChanged(t *testing.T) {
func TestDcRemoved(t *testing.T) {
kcOld := createClusterObjWithCassandraConfig("testcluster", "testns")
kcNew := kcOld.DeepCopy()
require.False(t, DcRemoved(kcOld.Spec, kcNew.Spec))
kcOld.Spec.Cassandra.Datacenters = append(kcOld.Spec.Cassandra.Datacenters, CassandraDatacenterTemplate{
Meta: EmbeddedObjectMeta{
Name: "dc2",
},
})
require.True(t, DcRemoved(kcOld.Spec, kcNew.Spec))
kcOld = createClusterObjWithCassandraConfig("testcluster", "testns")
kcNew = kcOld.DeepCopy()
kcNew.Spec.Cassandra.Datacenters[0].Meta.Name = "newName"
require.True(t, DcRemoved(kcOld.Spec, kcNew.Spec))
}

func TestDcAdded(t *testing.T) {
kcOld := createClusterObjWithCassandraConfig("testcluster", "testns")
kcNew := kcOld.DeepCopy()
require.False(t, DcAdded(kcOld.Spec, kcNew.Spec))
kcNew.Spec.Cassandra.Datacenters = append(kcOld.Spec.Cassandra.Datacenters, CassandraDatacenterTemplate{
Meta: EmbeddedObjectMeta{
Name: "dc2",
},
})
require.True(t, DcAdded(kcOld.Spec, kcNew.Spec))

kcOld = createClusterObjWithCassandraConfig("testcluster", "testns")
kcNew = kcOld.DeepCopy()
kcNew.Spec.Cassandra.Datacenters[0].Meta.Name = "newName"
require.True(t, DcAdded(kcOld.Spec, kcNew.Spec))
}

0 comments on commit 50432b1

Please sign in to comment.