Skip to content

Commit

Permalink
[bitnami/solr] test: ✅ Improve reliability of ginkgo tests (#29463)
Browse files Browse the repository at this point in the history
* [bitnami/solr] 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]>

* chore: 🔧 Bump timeout

Signed-off-by: Javier J. Salmerón García <[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 63b5131 commit 1e01d4e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .vib/solr/ginkgo/solr_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func init() {
flag.StringVar(&namespace, "namespace", "", "namespace where the application is running")
flag.StringVar(&username, "username", "", "database user")
flag.StringVar(&password, "password", "", "database password for username")
flag.IntVar(&timeoutSeconds, "timeout", 120, "timeout in seconds")
flag.IntVar(&timeoutSeconds, "timeout", 200, "timeout in seconds")
timeout = time.Duration(timeoutSeconds) * time.Second
}

Expand Down
18 changes: 9 additions & 9 deletions .vib/solr/ginkgo/solr_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 @@ -35,6 +36,7 @@ var _ = Describe("Solr", Ordered, func() {

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{}

By("checking all the replicas are available")
Expand Down Expand Up @@ -71,17 +73,15 @@ var _ = Describe("Solr", Ordered, func() {
return c.BatchV1().Jobs(namespace).Get(ctx, createColJobName, 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/solr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## 9.4.4 (2024-09-16)
## 9.4.5 (2024-09-17)

* [bitnami/solr] Use common password manager to handle password ([#29430](https://github.com/bitnami/charts/pull/29430))
* [bitnami/solr] test: :white_check_mark: Improve reliability of ginkgo tests ([#29463](https://github.com/bitnami/charts/pull/29463))

## <small>9.4.4 (2024-09-16)</small>

* [bitnami/solr] Use common password manager to handle password (#29430) ([3ecd8bd](https://github.com/bitnami/charts/commit/3ecd8bd03ceb15b03d06744989dc6aafab51c34d)), closes [#29430](https://github.com/bitnami/charts/issues/29430)

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

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

0 comments on commit 1e01d4e

Please sign in to comment.