Skip to content

Commit

Permalink
Rename and document PVC-related function names in tests
Browse files Browse the repository at this point in the history
Signed-off-by: d-kuro <[email protected]>
  • Loading branch information
d-kuro committed Aug 11, 2023
1 parent bf167e2 commit dfa8b9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
8 changes: 4 additions & 4 deletions e2e/pvc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ var _ = Context("pvc_test", func() {
})

It("should statefulset re-created", func() {
comparePVCTemplate("pvc", "cluster")
verifyPVCTemplates("pvc", "cluster")
})

It("should pvc resized", func() {
comparePVCSize("pvc", "cluster")
verifyPVCSize("pvc", "cluster")
})

It("should pvc template storage size reduce succeed", func() {
Expand All @@ -96,7 +96,7 @@ var _ = Context("pvc_test", func() {
})

It("should statefulset re-created", func() {
comparePVCTemplate("pvc", "cluster")
verifyPVCTemplates("pvc", "cluster")
})

It("should volume size reduce succeed", func() {
Expand Down Expand Up @@ -131,7 +131,7 @@ var _ = Context("pvc_test", func() {
})

It("should pvc resized", func() {
comparePVCSize("pvc", "cluster")
verifyPVCSize("pvc", "cluster")
})

It("metrics", func() {
Expand Down
17 changes: 11 additions & 6 deletions e2e/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import (
"reflect"
"text/template"

corev1 "k8s.io/api/core/v1"

appsv1 "k8s.io/api/apps/v1"

mocov1beta2 "github.com/cybozu-go/moco/api/v1beta2"
. "github.com/onsi/gomega"
dto "github.com/prometheus/client_model/go"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
)

Expand Down Expand Up @@ -90,7 +88,11 @@ OUTER:
return nil
}

func comparePVCTemplate(ns string, clusterName string) {
// verifyPVCTemplates verifies the labels and storage size of PVC templates in a specific cluster.
// It builds two maps of anticipated PVC labels and sizes based on the cluster specifications,
// Retrieves a StatefulSet using Kubernetes API and compares its PVC templates' labels and sizes
// with the anticipated ones.
func verifyPVCTemplates(ns string, clusterName string) {
cluster, err := getCluster(ns, clusterName)
Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -144,7 +146,10 @@ func comparePVCTemplate(ns string, clusterName string) {
}).Should(Succeed())
}

func comparePVCSize(ns string, clusterName string) {
// verifyPVCSize validates the storage size of Persistent Volume Claims (PVC) in a specific cluster.
// It builds a map of anticipated PVC sizes, retrieves the current state of PVCs from the Kubernetes API,
// and assesses if the actual PVC sizes coincide with the predicted sizes.
func verifyPVCSize(ns string, clusterName string) {
cluster, err := getCluster(ns, clusterName)
Expect(err).NotTo(HaveOccurred())

Expand Down

0 comments on commit dfa8b9c

Please sign in to comment.