From 73719a47a4a8d046dc9a4b9cd6534c49285e2c39 Mon Sep 17 00:00:00 2001 From: Ishan Khare Date: Thu, 9 Nov 2023 14:32:52 +0530 Subject: [PATCH] log metrics tests into ginkgo writer Signed-off-by: Ishan Khare --- test/e2e_metrics_proxy/metricsProxy.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/e2e_metrics_proxy/metricsProxy.go b/test/e2e_metrics_proxy/metricsProxy.go index 8eae7496aa..3893475eea 100644 --- a/test/e2e_metrics_proxy/metricsProxy.go +++ b/test/e2e_metrics_proxy/metricsProxy.go @@ -2,6 +2,7 @@ package e2emetricsproxy import ( "context" + "fmt" "time" "github.com/loft-sh/vcluster/pkg/metricsapiservice" @@ -10,7 +11,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/klog/v2" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" apiregistrationv1clientset "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1" @@ -43,21 +43,23 @@ var _ = ginkgo.Describe("Target Namespace", func() { nodeMetricsList, err := metricsClient.NodeMetricses().List(f.Context, metav1.ListOptions{}) if err != nil { + fmt.Fprintf(ginkgo.GinkgoWriter, "error getting node metrics list %v", err) return false, nil } if len(nodeMetricsList.Items) == 0 { - klog.Errorf("expecting node metrics list to have at least 1 entry, got %s", len(nodeMetricsList.Items)) + fmt.Fprintf(ginkgo.GinkgoWriter, "expecting node metrics list to have at least 1 entry, got %d", len(nodeMetricsList.Items)) return false, nil } podMetricsList, err := metricsClient.PodMetricses("kube-system").List(f.Context, metav1.ListOptions{}) if err != nil { + fmt.Fprintf(ginkgo.GinkgoWriter, "error getting pod metrics list %v", err) return false, nil } if len(podMetricsList.Items) == 0 { - klog.Errorf("expecting node metrics list to have at least 1 entry, got %s", len(podMetricsList.Items)) + fmt.Fprintf(ginkgo.GinkgoWriter, "expecting pod metrics list to have at least 1 entry, got %d", len(podMetricsList.Items)) return false, nil }