Skip to content

Commit

Permalink
Check process groups in the cluster status in addition to the pods an…
Browse files Browse the repository at this point in the history
…d ignore pods marked for deletion
  • Loading branch information
johscheuer committed Sep 21, 2023
1 parent 6970c48 commit b2a1008
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 2 additions & 4 deletions controllers/cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2569,8 +2569,7 @@ var _ = Describe("cluster_controller", func() {
Context("with a change to the process group ID prefix", func() {
BeforeEach(func() {
cluster.Spec.ProcessGroupIDPrefix = "dev"
err = k8sClient.Update(context.TODO(), cluster)
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient.Update(context.TODO(), cluster)).NotTo(HaveOccurred())
})

It("should replace the process groups", func() {
Expand All @@ -2593,8 +2592,7 @@ var _ = Describe("cluster_controller", func() {

It("should generate process group IDs with the new prefix", func() {
pods := &corev1.PodList{}
err = k8sClient.List(context.TODO(), pods, getListOptions(cluster)...)
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient.List(context.TODO(), pods, getListOptions(cluster)...)).NotTo(HaveOccurred())

sortPodsByName(pods)
Expect(pods.Items[0].Labels[fdbv1beta2.FDBProcessGroupIDLabel]).To(Equal("dev-cluster_controller-2"))
Expand Down
8 changes: 8 additions & 0 deletions e2e/test_operator/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,16 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
})

It("should add the prefix to all instances", func() {
for _, processGroup := range fdbCluster.GetCluster().Status.ProcessGroups {
Expect(string(processGroup.ProcessGroupID)).To(HavePrefix(prefix))
}

pods := fdbCluster.GetPods()
for _, pod := range pods.Items {
// Ignore any old Pods that are marked for removal.
if !pod.DeletionTimestamp.IsZero() {
continue
}
Expect(string(fixtures.GetProcessGroupID(pod))).To(HavePrefix(prefix))
}
})
Expand Down

0 comments on commit b2a1008

Please sign in to comment.