Skip to content

Commit

Permalink
[bitnami/valkey] test: ✅ Improve reliability of ginkgo tests (#29474)
Browse files Browse the repository at this point in the history
* [bitnami/valkey] test: ✅ Improve reliability of ginkgo tests

Signed-off-by: Javier J. Salmerón García <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <[email protected]>

---------

Signed-off-by: Javier J. Salmerón García <[email protected]>
Signed-off-by: Bitnami Containers <[email protected]>
Co-authored-by: Bitnami Containers <[email protected]>
  • Loading branch information
javsalgar and bitnami-bot authored Sep 17, 2024
1 parent 03fc421 commit 4bccd45
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
18 changes: 9 additions & 9 deletions .vib/valkey/ginkgo/valkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -34,6 +35,7 @@ var _ = Describe("Valkey", Ordered, func() {
It("should have access to the created key-value", func() {

getAvailableReplicas := func(ss *appsv1.StatefulSet) int32 { return ss.Status.AvailableReplicas }
getRestartedAtAnnotation := func(pod *v1.Pod) string { return pod.Annotations["kubectl.kubernetes.io/restartedAt"] }
getSucceededJobs := func(j *batchv1.Job) int32 { return j.Status.Succeeded }
getOpts := metav1.GetOptions{}

Expand Down Expand Up @@ -71,17 +73,15 @@ var _ = Describe("Valkey", Ordered, func() {
return c.BatchV1().Jobs(namespace).Get(ctx, createKEYJobName, getOpts)
}, timeout, PollingInterval).Should(WithTransform(getSucceededJobs, Equal(int32(1))))

By("scaling down to 0 replicas")
ss, err = utils.StsScale(ctx, c, ss, 0)
By("rollout restart the statefulset")
_, err = utils.StsRolloutRestart(ctx, c, ss)
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)
Expect(err).NotTo(HaveOccurred())
for i := int(origReplicas) - 1; i >= 0; 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)
Expand Down
8 changes: 6 additions & 2 deletions bitnami/valkey/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## 0.3.17 (2024-09-14)
## 0.3.18 (2024-09-17)

* [bitnami/valkey] Release 0.3.17 ([#29413](https://github.com/bitnami/charts/pull/29413))
* [bitnami/valkey] test: :white_check_mark: Improve reliability of ginkgo tests ([#29474](https://github.com/bitnami/charts/pull/29474))

## <small>0.3.17 (2024-09-14)</small>

* [bitnami/valkey] Release 0.3.17 (#29413) ([0dd6ee7](https://github.com/bitnami/charts/commit/0dd6ee77dbc152583d6412260f801bfcefd3114d)), closes [#29413](https://github.com/bitnami/charts/issues/29413)

## <small>0.3.16 (2024-09-11)</small>

Expand Down
2 changes: 1 addition & 1 deletion bitnami/valkey/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ maintainers:
name: valkey
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/valkey
version: 0.3.17
version: 0.3.18

0 comments on commit 4bccd45

Please sign in to comment.