Skip to content

Commit 0c393ec

Browse files
authored
[chore] Fix flaky k8sevents functional test (#1705)
Ignoring attributes added by k8sattributes processor. This potentially can be fixed by enabling `wait_for_metadata` config option. However, the usage of that attribute is questionable, I don't think we should delay the start because of it
1 parent 74f63f5 commit 0c393ec

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

functional_tests/k8sevents/k8sevents_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func Test_K8SEvents(t *testing.T) {
5858
return re.ReplaceAllString(body, `Successfully pulled image "$1:latest" in <time> (<time> including waiting)`)
5959
})
6060

61-
// These container attributes may not get added by the k8sattributesprocessor on the events about container image pull/start
61+
// the following attributes are added by the k8sattributes processor which might not be ready when the test runs
6262
removeFlakyLogRecordAttr(k8sEventsLogs, "container.id")
6363
removeFlakyLogRecordAttr(k8sEventsLogs, "container.image.name")
6464
removeFlakyLogRecordAttr(k8sEventsLogs, "container.image.tag")
@@ -93,6 +93,10 @@ func Test_K8SEvents(t *testing.T) {
9393
k8sObjectsLogs = updateLogRecordBody(k8sObjectsLogs, []string{"object", "metadata", "managedFields", "0", "time"}, "2025-03-04T01:59:10Z")
9494
k8sObjectsLogs = updateLogRecordBody(k8sObjectsLogs, []string{"object", "metadata", "managedFields", "0", "manager"}, "k8sevents.test") // changes when the test name which runs k8s client changes
9595

96+
// the following attributes are added by the k8sattributes processor which might not be ready when the test runs
97+
removeFlakyLogRecordAttr(k8sObjectsLogs, "container.image.name")
98+
removeFlakyLogRecordAttr(k8sObjectsLogs, "container.image.tag")
99+
96100
expectedObjectsLogsFile := "testdata/expected_k8sobjects.yaml"
97101
expectedObjectsLogs, err := golden.ReadLogs(expectedObjectsLogsFile)
98102
require.NoError(t, err, "failed to read expected objects logs from file")

functional_tests/k8sevents/testdata/expected_k8sobjects.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ resourceLogs:
1616
scopeLogs:
1717
- logRecords:
1818
- attributes:
19-
- key: container.image.name
20-
value:
21-
stringValue: alpine
22-
- key: container.image.tag
23-
value:
24-
stringValue: latest
2519
- key: deployment.environment
2620
value:
2721
stringValue: dev

0 commit comments

Comments
 (0)