Skip to content

Commit

Permalink
add gardener shoot-info e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
hisarbalik committed Jan 27, 2025
1 parent d743a30 commit 86b8aaa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/e2e/metrics_runtime_input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ var _ = Describe(suite.ID(), Label(suite.LabelMetrics), Label("ttt"), Ordered, f
var objs []client.Object
objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject())

objs = append(objs, kitk8s.NewConfigMap("shoot-info", "kube-system").WithData("shootName", "kyma-telemetry").WithData("provider", "k3d").K8sObject())

// PipelineA should deliver only pod, container, volume and node metrics
// PipelineB should deliver only deployment, daemonset, statefulset and job metrics
// PipelineC should deliver default resource metrics (currently all resource metrics are enabled by default)
Expand Down
37 changes: 37 additions & 0 deletions test/testkit/k8s/configmap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package k8s

import (
"maps"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type ConfigMap struct {
name string
namespace string
data map[string]string
}

func NewConfigMap(cfName, ns string) *ConfigMap {
return &ConfigMap{
name: cfName,
namespace: ns,
data: make(map[string]string),
}
}

func (c *ConfigMap) WithData(key, value string) *ConfigMap {
maps.Copy(c.data, map[string]string{key: value})
return c
}

func (c *ConfigMap) K8sObject() *corev1.ConfigMap {
return &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: c.name,
Namespace: c.namespace,
},
Data: c.data,
}
}
1 change: 1 addition & 0 deletions test/testkit/metrics/runtime/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var (
"cloud.availability_zone",
"host.type",
"host.arch",
"cloud.provider",
}

PodMetricsAttributes = map[string][]string{
Expand Down

0 comments on commit 86b8aaa

Please sign in to comment.