From 75574401e7fd9aa8f272606f02dc1003b2d537c2 Mon Sep 17 00:00:00 2001 From: Tomas Smetana Date: Mon, 26 Oct 2020 13:05:06 +0100 Subject: [PATCH] Add e2e test for the newPV Controller metric --- test/e2e/storage/volume_metrics.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/e2e/storage/volume_metrics.go b/test/e2e/storage/volume_metrics.go index eae8360e216..3afc7c2a4da 100644 --- a/test/e2e/storage/volume_metrics.go +++ b/test/e2e/storage/volume_metrics.go @@ -381,9 +381,12 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() { // Test for pv controller metrics, concretely: bound/unbound pv/pvc count. ginkgo.Describe("PVController", func() { const ( - classKey = "storage_class" - namespaceKey = "namespace" + classKey = "storage_class" + namespaceKey = "namespace" + pluginNameKey = "plugin_name" + volumeModeKey = "volume_mode" + totalPVKey = "pv_collector_total_pv_count" boundPVKey = "pv_collector_bound_pv_count" unboundPVKey = "pv_collector_unbound_pv_count" boundPVCKey = "pv_collector_bound_pvc_count" @@ -506,6 +509,18 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() { validator([]map[string]int64{{className: 1}, nil, {ns: 1}, nil}) }) + ginkgo.It("should create total pv count metrics for with plugin and volume mode labels after creating pv", + func() { + var err error + dimensions := []string{pluginNameKey, volumeModeKey} + pv, err = e2epv.CreatePV(c, pv) + framework.ExpectNoError(err, "Error creating pv: %v", err) + waitForPVControllerSync(metricsGrabber, totalPVKey, pluginNameKey) + controllerMetrics, err := metricsGrabber.GrabFromControllerManager() + framework.ExpectNoError(err, "Error getting c-m metricValues: %v", err) + err = testutil.ValidateMetrics(testutil.Metrics(controllerMetrics), totalPVKey, dimensions...) + framework.ExpectNoError(err, "Invalid metric in Controller Manager metrics: %q", totalPVKey) + }) }) })