Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
vimystic committed Nov 20, 2024
1 parent 75dcd8a commit bfe1a51
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/fullnode/build_pods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,23 @@ func TestBuildPods(t *testing.T) {
Image: "busybox:latest",
},
InstanceOverrides: nil,
Ordinal: cosmosv1.Ordinal{
Start: 2,
},
},
}

cksums := make(ConfigChecksums)
startingOrdinal := int32(2)
for i := 0; i < int(crd.Spec.Replicas); i++ {
cksums[client.ObjectKey{Namespace: crd.Namespace, Name: fmt.Sprintf("agoric-%d", i+int(startingOrdinal))}] = strconv.Itoa(i + int(startingOrdinal))
cksums[client.ObjectKey{Namespace: crd.Namespace, Name: fmt.Sprintf("agoric-%d", i+int(crd.Spec.Ordinal.Start))}] = strconv.Itoa(i + int(crd.Spec.Ordinal.Start))
}

pods, err := BuildPods(crd, cksums)
require.NoError(t, err)
require.Equal(t, 5, len(pods))

for i, r := range pods {
expectedOrdinal := startingOrdinal + int32(i)
expectedOrdinal := crd.Spec.Ordinal.Start + int32(i)
require.Equal(t, int64(expectedOrdinal), r.Ordinal(), i)
require.NotEmpty(t, r.Revision(), i)
require.Equal(t, strconv.Itoa(int(expectedOrdinal)), r.Object().Annotations["cosmos.strange.love/config-checksum"])
Expand All @@ -56,7 +58,7 @@ func TestBuildPods(t *testing.T) {
got := lo.Map(pods, func(pod diff.Resource[*corev1.Pod], _ int) string { return pod.Object().Name })
require.Equal(t, want, got)

pod, err := NewPodBuilder(crd).WithOrdinal(startingOrdinal).Build()
pod, err := NewPodBuilder(crd).WithOrdinal(crd.Spec.Ordinal.Start).Build()
require.NoError(t, err)
require.Equal(t, pod.Spec, pods[0].Object().Spec)
})
Expand Down

0 comments on commit bfe1a51

Please sign in to comment.