Skip to content

Commit

Permalink
E2E test
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Wall <richard.wall@venafi.com>
  • Loading branch information
wallrj committed Jun 25, 2024
1 parent f5afbcc commit ade19a2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
7 changes: 6 additions & 1 deletion deploy/charts/csi-driver/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# metrics:
# enabled: false
# podMonitor:
# enabled: false

image:
# Target image registry. This value is prepended to the target image repository, if set.
# For example:
Expand Down Expand Up @@ -130,7 +135,7 @@ nodeSelector:
kubernetes.io/os: linux

# Kubernetes affinity: constraints for pod assignment.
#
#
# For example:
# affinity:
# nodeAffinity:
Expand Down
1 change: 1 addition & 0 deletions make/test-e2e.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ endif

test-e2e-deps: INSTALL_OPTIONS :=
test-e2e-deps: INSTALL_OPTIONS += --set image.repository=$(oci_manager_image_name_development)
# test-e2e-deps: INSTALL_OPTIONS += --set metrics.enabled=true
test-e2e-deps: e2e-setup-cert-manager
test-e2e-deps: install

Expand Down
34 changes: 34 additions & 0 deletions test/e2e/suite/cases/metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cases

import (
"context"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/cert-manager/csi-driver/test/e2e/framework"
)

const certManagerNamespace = "cert-manager"

var _ = framework.CasesDescribe("Metrics", func() {
f := framework.NewDefaultFramework("metrics")

FIt("should serve metrics", func() {
pods, err := f.KubeClientSet.CoreV1().Pods(certManagerNamespace).List(context.TODO(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/instance=csi-driver",
})
Expect(err).NotTo(HaveOccurred())
Expect(pods.Items).To(HaveLen(1))
for _, p := range pods.Items {
resp, err := f.KubeClientSet.
CoreV1().
Pods(p.Namespace).
ProxyGet("http", p.Name, "8080", "/metrics", map[string]string{}).
DoRaw(context.TODO())
Expect(err).NotTo(HaveOccurred())
Expect(string(resp)).To(Equal("foo"))
}
})
})

0 comments on commit ade19a2

Please sign in to comment.