diff --git a/.vib/cassandra/ginkgo/cassandra_test.go b/.vib/cassandra/ginkgo/cassandra_test.go index 4d68c850390790..263eecda7a0552 100644 --- a/.vib/cassandra/ginkgo/cassandra_test.go +++ b/.vib/cassandra/ginkgo/cassandra_test.go @@ -10,6 +10,7 @@ import ( . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" ) @@ -35,6 +36,7 @@ var _ = Describe("Cassandra", Ordered, func() { By("checking all the replicas are available") getAvailableReplicas := func(ss *appsv1.StatefulSet) int32 { return ss.Status.AvailableReplicas } getSucceededJobs := func(j *batchv1.Job) int32 { return j.Status.Succeeded } + getRestartedAtAnnotation := func(pod *v1.Pod) string { return pod.Annotations["kubectl.kubernetes.io/restartedAt"] } getOpts := metav1.GetOptions{} ss, err := c.AppsV1().StatefulSets(namespace).Get(ctx, stsName, getOpts) @@ -71,19 +73,20 @@ var _ = Describe("Cassandra", Ordered, func() { return c.BatchV1().Jobs(namespace).Get(ctx, createDBJobName, getOpts) }, timeout, PollingInterval).Should(WithTransform(getSucceededJobs, Equal(int32(1)))) - By("scaling down to 0 replicas") - - ss, err = utils.StsScale(ctx, c, ss, 0) + By("deleting the job once it has succeeded") + err = c.BatchV1().Jobs(namespace).Delete(ctx, createDBJobName, metav1.DeleteOptions{}) Expect(err).NotTo(HaveOccurred()) - Eventually(func() (*appsv1.StatefulSet, error) { - return c.AppsV1().StatefulSets(namespace).Get(ctx, stsName, getOpts) - }, timeout, PollingInterval).Should(WithTransform(getAvailableReplicas, BeZero())) - - By("scaling up to the original replicas") - ss, err = utils.StsScale(ctx, c, ss, origReplicas) + By("rollout restart the statefulset") + _, err = utils.StsRolloutRestart(ctx, c, ss) Expect(err).NotTo(HaveOccurred()) + for i := 0; i < int(origReplicas); i++ { + Eventually(func() (*v1.Pod, error) { + return c.CoreV1().Pods(namespace).Get(ctx, fmt.Sprintf("%s-%d", stsName, i), getOpts) + }, timeout, PollingInterval).Should(WithTransform(getRestartedAtAnnotation, Not(BeEmpty()))) + } + Eventually(func() (*appsv1.StatefulSet, error) { return c.AppsV1().StatefulSets(namespace).Get(ctx, stsName, getOpts) }, timeout, PollingInterval).Should(WithTransform(getAvailableReplicas, Equal(origReplicas))) @@ -97,6 +100,10 @@ var _ = Describe("Cassandra", Ordered, func() { Eventually(func() (*batchv1.Job, error) { return c.BatchV1().Jobs(namespace).Get(ctx, deleteDBJobName, getOpts) }, timeout, PollingInterval).Should(WithTransform(getSucceededJobs, Equal(int32(1)))) + + By("deleting the job once it has succeeded") + err = c.BatchV1().Jobs(namespace).Delete(ctx, deleteDBJobName, metav1.DeleteOptions{}) + Expect(err).NotTo(HaveOccurred()) }) }) diff --git a/bitnami/cassandra/CHANGELOG.md b/bitnami/cassandra/CHANGELOG.md index 6aff30cef50a11..0b4b6f930428f3 100644 --- a/bitnami/cassandra/CHANGELOG.md +++ b/bitnami/cassandra/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog -## 11.3.11 (2024-07-25) +## 11.3.12 (2024-07-31) -* [bitnami/cassandra] Release 11.3.11 ([#28408](https://github.com/bitnami/charts/pull/28408)) +* [bitnami/cassandra] Improve Ginkgo test ([#28603](https://github.com/bitnami/charts/pull/28603)) + +## 11.3.11 (2024-07-25) + +* [bitnami/cassandra] Release 11.3.11 (#28408) ([8a65384](https://github.com/bitnami/charts/commit/8a6538440b1ca408369ec814831f6239fe47fa3b)), closes [#28408](https://github.com/bitnami/charts/issues/28408) ## 11.3.10 (2024-07-24) diff --git a/bitnami/cassandra/Chart.yaml b/bitnami/cassandra/Chart.yaml index 53fc1ef8d384d7..18a93a7718aa9c 100644 --- a/bitnami/cassandra/Chart.yaml +++ b/bitnami/cassandra/Chart.yaml @@ -32,4 +32,4 @@ maintainers: name: cassandra sources: - https://github.com/bitnami/charts/tree/main/bitnami/cassandra -version: 11.3.11 +version: 11.3.12