Skip to content

Commit 540b117

Browse files
committed
update: use namespace filter in e2e tests
remove unused file Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
1 parent 685b648 commit 540b117

2 files changed

Lines changed: 9 additions & 478 deletions

File tree

k8s-deployment/tests/e2e_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ const (
4444

4545
outgoingDir = "outgoing"
4646
incomingDir = "incoming"
47+
48+
telemetryNs = "open-telemetry"
49+
defaultNs = "default"
4750
)
4851

4952
var nonAlphanumericRegex = regexp.MustCompile(`[^a-zA-Z0-9]`)
@@ -201,10 +204,10 @@ func getNodeIP(ctx context.Context, client *kubernetes.Clientset) (string, error
201204
return "", fmt.Errorf("no node internal IP found")
202205
}
203206

204-
func getPodAttributes(t *testing.T, client *kubernetes.Clientset, podLabel string) map[string]string {
207+
func getPodAttributes(t *testing.T, client *kubernetes.Clientset, podLabel string, ns string) map[string]string {
205208
var pod corev1.Pod
206209
require.Eventually(t, func() bool {
207-
pods, err := client.CoreV1().Pods("").List(t.Context(), metav1.ListOptions{LabelSelector: podLabel})
210+
pods, err := client.CoreV1().Pods(ns).List(t.Context(), metav1.ListOptions{LabelSelector: podLabel})
208211
if err != nil {
209212
t.Logf("cannot find pod with label %s: %v", podLabel, err)
210213
return false
@@ -323,10 +326,10 @@ func TestBasicOTELMetrics(t *testing.T) {
323326
//////////////////////
324327
// Get all pods info
325328
//////////////////////
326-
otelCollectorAttrs := getPodAttributes(t, client, otelCollectorLabels)
327-
prometheusAttrs := getPodAttributes(t, client, prometheusLabels)
328-
postgresClientAttrs := getPodAttributes(t, client, postgresClientLabels)
329-
postgresServerAttrs := getPodAttributes(t, client, postgresServerLabels)
329+
otelCollectorAttrs := getPodAttributes(t, client, otelCollectorLabels, telemetryNs)
330+
prometheusAttrs := getPodAttributes(t, client, prometheusLabels, telemetryNs)
331+
postgresClientAttrs := getPodAttributes(t, client, postgresClientLabels, defaultNs)
332+
postgresServerAttrs := getPodAttributes(t, client, postgresServerLabels, defaultNs)
330333

331334
extraPostgresAttrs := map[string]string{
332335
postgresSQLCommandTag: "SELECT",

0 commit comments

Comments
 (0)