Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoravong committed Sep 9, 2024
1 parent 08c1f77 commit d8c1797
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/functional_test_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
inputs:
UPDATE_EXPECTED_RESULTS:
description: 'Set this to true to update expected results and collect new test output.'
description: 'Set this to true to update expected results and collect updated test output as a Github workflow artifact.'
required: false
default: false

Expand Down
18 changes: 9 additions & 9 deletions functional_tests/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ func testNodeJSTraces(t *testing.T) {
ptracetest.IgnoreScopeSpansOrder(),
)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedTracesFile, *selectedTrace)
writeNewExpectedTracesResult(t, expectedTracesFile, selectedTrace)
}
require.NoError(t, err)
}
Expand Down Expand Up @@ -676,7 +676,7 @@ func testJavaTraces(t *testing.T) {
ptracetest.IgnoreScopeSpansOrder(),
)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedTracesFile, *selectedTrace)
writeNewExpectedTracesResult(t, expectedTracesFile, selectedTrace)
}
require.NoError(t, err)
}
Expand Down Expand Up @@ -741,7 +741,7 @@ func testDotNetTraces(t *testing.T) {
ptracetest.IgnoreScopeSpansOrder(),
)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedTracesFile, *selectedTrace)
writeNewExpectedTracesResult(t, expectedTracesFile, selectedTrace)
}
require.NoError(t, err)
}
Expand Down Expand Up @@ -799,7 +799,7 @@ func testK8sClusterReceiverMetrics(t *testing.T) {

replaceWithStar := func(string) string { return "*" }

var selected *pmetric.Metrics
var selectedMetrics *pmetric.Metrics
for h := len(metricsConsumer.AllMetrics()) - 1; h >= 0; h-- {
m := metricsConsumer.AllMetrics()[h]
foundCorrectSet := false
Expand All @@ -819,15 +819,15 @@ func testK8sClusterReceiverMetrics(t *testing.T) {
continue
}
if m.ResourceMetrics().Len() == expectedMetrics.ResourceMetrics().Len() && m.MetricCount() == expectedMetrics.MetricCount() {
selected = &m
selectedMetrics = &m
break
}
}
require.NotNil(t, selected)

metricNames := []string{"k8s.node.condition_ready", "k8s.namespace.phase", "k8s.pod.phase", "k8s.replicaset.desired", "k8s.replicaset.available", "k8s.daemonset.ready_nodes", "k8s.daemonset.misscheduled_nodes", "k8s.daemonset.desired_scheduled_nodes", "k8s.daemonset.current_scheduled_nodes", "k8s.container.ready", "k8s.container.memory_request", "k8s.container.memory_limit", "k8s.container.cpu_request", "k8s.container.cpu_limit", "k8s.deployment.desired", "k8s.deployment.available", "k8s.container.restarts", "k8s.container.cpu_request", "k8s.container.memory_request", "k8s.container.memory_limit"}

err = pmetrictest.CompareMetrics(expectedMetrics, *selected,
err = pmetrictest.CompareMetrics(expectedMetrics, *selectedMetrics,
pmetrictest.IgnoreTimestamp(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreMetricAttributeValue("container.id", metricNames...),
Expand Down Expand Up @@ -864,7 +864,7 @@ func testK8sClusterReceiverMetrics(t *testing.T) {
pmetrictest.IgnoreSubsequentDataPoints("k8s.container.ready", "k8s.container.restarts"),
)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedTracesResult(t, expectedMetricsFile, *selectedMetric)
writeNewExpectedMetricssResult(t, expectedMetricsFile, selectedMetrics)
}
require.NoError(t, err)
}
Expand Down Expand Up @@ -1170,7 +1170,7 @@ func testAgentMetrics(t *testing.T) {
pmetrictest.IgnoreMetricDataPointsOrder(),
)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedTracesResult(t, expectedMetricsFile, *selectedMetric)
writeNewExpectedTracesResult(t, expectedMetricsFile, selectedInternalMetrics)
}
assert.NoError(t, err)

Expand Down Expand Up @@ -1224,7 +1224,7 @@ func testAgentMetrics(t *testing.T) {
pmetrictest.IgnoreMetricDataPointsOrder(),
)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedTracesResult(t, expectedMetricsFile, *selectedMetric)
writeNewExpectedMetricssResult(t, expectedKubeletStatsMetricsFile, *selectedKubeletstatsMetrics)
t.Skipf("we have trouble identifying exact payloads right now: %v", err)
} else {
assert.NoError(t, err)
Expand Down
16 changes: 8 additions & 8 deletions functional_tests/histogram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func testHistogramMetrics(t *testing.T) {
)
assert.NoError(t, err)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedCoreDNSMetricsFile, *corednsMetrics)
writeNewExpectedMetricsResult(t, expectedCoreDNSMetricsFile, corednsMetrics)
}

err = pmetrictest.CompareMetrics(expectedKubeSchedulerMetrics, *schedulerMetrics,
Expand Down Expand Up @@ -293,7 +293,7 @@ func testHistogramMetrics(t *testing.T) {
)
assert.NoError(t, err)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedKubeSchedulerMetricsFile, *etcdMetrics)
writeNewExpectedMetricsResult(t, expectedKubeSchedulerMetricsFile, etcdMetrics)
}

err = pmetrictest.CompareMetrics(expectedKubeProxyMetrics, *kubeProxyMetrics,
Expand Down Expand Up @@ -321,7 +321,7 @@ func testHistogramMetrics(t *testing.T) {
)
assert.NoError(t, err)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedKubeProxyMetricsFile, *selected)
writeNewExpectedMetricsResult(t, expectedKubeProxyMetricsFile, expectedKubeProxyMetrics)
}

err = pmetrictest.CompareMetrics(expectedApiMetrics, *apiMetrics,
Expand All @@ -341,10 +341,10 @@ func testHistogramMetrics(t *testing.T) {
)
assert.NoError(t, err)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedApiMetricsFile, *apiMetrics)
writeNewExpectedMetricsResult(t, expectedApiMetricsFile, apiMetrics)
}

err = pmetrictest.CompareMetrics(expectedControllerManagerMetrics, *controllerManagerMetrics,
err = pmetrictest.CompareMetrics(expectedControllerManagerMetrics, controllerManagerMetrics,
pmetrictest.IgnoreTimestamp(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreMetricValues(),
Expand All @@ -369,10 +369,10 @@ func testHistogramMetrics(t *testing.T) {
)
assert.NoError(t, err)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedControllerManagerMetricsFile, *controllerManagerMetrics)
writeNewExpectedMetricsResult(t, expectedControllerManagerMetricsFile, controllerManagerMetrics)
}

err = pmetrictest.CompareMetrics(expectedEtcdMetrics, *etcdMetrics,
err = pmetrictest.CompareMetrics(expectedEtcdMetrics, etcdMetrics,
pmetrictest.IgnoreTimestamp(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreMetricValues(),
Expand All @@ -399,6 +399,6 @@ func testHistogramMetrics(t *testing.T) {
)
assert.NoError(t, err)
if err != nil && os.Getenv("UPDATE_EXPECTED_RESULTS") == "true" {
writeNewExpectedMetricsResult(t, expectedEtcdMetricsFile, *etcdMetrics)
writeNewExpectedMetricsResult(t, expectedEtcdMetricsFile, etcdMetrics)
}
}

0 comments on commit d8c1797

Please sign in to comment.