Skip to content

Commit

Permalink
log metrics tests into ginkgo writer
Browse files Browse the repository at this point in the history
Signed-off-by: Ishan Khare <[email protected]>
  • Loading branch information
ishankhare07 committed Nov 9, 2023
1 parent 9fcf6d9 commit 73719a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/e2e_metrics_proxy/metricsProxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package e2emetricsproxy

import (
"context"
"fmt"
"time"

"github.com/loft-sh/vcluster/pkg/metricsapiservice"
Expand All @@ -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"

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 73719a4

Please sign in to comment.