From c8bd6d35e1953a307f427c713a27b7df06864ed8 Mon Sep 17 00:00:00 2001 From: odubajDT Date: Wed, 25 Sep 2024 12:15:43 +0200 Subject: [PATCH] revert to original state Signed-off-by: odubajDT --- .../integration/combinedload/e2e_test.go | 51 ++++++++----------- .../testdata/collector/deployment.yaml | 4 +- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/internal/testbed/integration/combinedload/e2e_test.go b/internal/testbed/integration/combinedload/e2e_test.go index f353af44..292852fe 100644 --- a/internal/testbed/integration/combinedload/e2e_test.go +++ b/internal/testbed/integration/combinedload/e2e_test.go @@ -1,6 +1,7 @@ package combinedload import ( + "context" "fmt" "os" "path/filepath" @@ -88,35 +89,25 @@ func TestLoad_Combined(t *testing.T) { require.NoError(t, err) t.Log("collecting data...") - // ctx, cancel := context.WithTimeout(context.Background(), 151*time.Second) - // defer cancel() - // interval := 15 * time.Second - // i := 0 - // for { - // select { - // case <-time.After(interval): - // i += 1 - // //fetch metrics data - // cpu, mem, err := k8stest.FetchPodMetrics(metricsClientSet, testNs, otelColPodName) - // require.NoError(t, err) - - // t.Log("------------------------------------------------------") - // t.Logf("data after %d seconds:", i*int(interval.Seconds())) - // t.Logf("memory: %s, cpu: %s", mem, cpu) - // t.Log("------------------------------------------------------") - // case <-ctx.Done(): - // return - // } - for seconds := 15; seconds < 151; seconds += 15 { - time.Sleep(15 * time.Second) - - //fetch metrics data - cpu, mem, err := k8stest.FetchPodMetrics(metricsClientSet, testNs, otelColPodName) - require.NoError(t, err) - - t.Log("------------------------------------------------------") - t.Logf("data after %d seconds:", seconds) - t.Logf("memory: %s, cpu: %s", mem, cpu) - t.Log("------------------------------------------------------") + ctx, cancel := context.WithTimeout(context.Background(), 151*time.Second) + defer cancel() + interval := 15 * time.Second + ticker := time.NewTicker(interval) + i := 0 + for { + select { + case <-ticker.C: + i += 1 + //fetch metrics data + cpu, mem, err := k8stest.FetchPodMetrics(metricsClientSet, testNs, otelColPodName) + require.NoError(t, err) + + t.Log("------------------------------------------------------") + t.Logf("data after %d seconds:", i*int(interval.Seconds())) + t.Logf("memory: %s, cpu: %s", mem, cpu) + t.Log("------------------------------------------------------") + case <-ctx.Done(): + return + } } } diff --git a/internal/testbed/integration/combinedload/testdata/collector/deployment.yaml b/internal/testbed/integration/combinedload/testdata/collector/deployment.yaml index 7df7675e..ac8aa33b 100644 --- a/internal/testbed/integration/combinedload/testdata/collector/deployment.yaml +++ b/internal/testbed/integration/combinedload/testdata/collector/deployment.yaml @@ -44,8 +44,8 @@ spec: initialDelaySeconds: 3 resources: limits: - cpu: 512m - memory: 1024Mi + cpu: 128m + memory: 256Mi volumeMounts: - mountPath: /conf name: opentelemetry-collector-configmap