@@ -52,7 +52,6 @@ var eventsLogsConsumer *consumertest.LogsSink
52
52
// UPDATE_EXPECTED_RESULTS: if set to true, the test will update the expected results
53
53
// KUBECONFIG: the path to the kubeconfig file
54
54
func Test_K8SEvents (t * testing.T ) {
55
- t .Skip ("Skip until fixed" )
56
55
eventsLogsConsumer := setup (t )
57
56
if os .Getenv ("SKIP_TESTS" ) == "true" {
58
57
t .Log ("Skipping tests as SKIP_TESTS is set to true" )
@@ -64,10 +63,14 @@ func Test_K8SEvents(t *testing.T) {
64
63
t .Run ("CheckK8SEventsLogs" , func (t * testing.T ) {
65
64
actualLogs := selectResLogs ("com.splunk.sourcetype" , "kube:events" , eventsLogsConsumer )
66
65
k8sEventsLogs := selectLogs (t , "k8s.namespace.name" , "k8sevents-test" , & actualLogs , func (body string ) string {
67
- re := regexp .MustCompile (`Successfully pulled image "busybox:latest" in .* \(.* including waiting\)` )
66
+ re := regexp .MustCompile (`Successfully pulled image "busybox:latest" in .* \(.* including waiting\).* ` )
68
67
return re .ReplaceAllString (body , `Successfully pulled image "busybox:latest" in <time> (<time> including waiting)` )
69
68
})
69
+
70
+ // These container attributes may not get added by the k8sattributesprocessor on the events about container image pull/start
70
71
removeFlakyLogRecordAttr (k8sEventsLogs , "container.id" )
72
+ removeFlakyLogRecordAttr (k8sEventsLogs , "container.image.name" )
73
+ removeFlakyLogRecordAttr (k8sEventsLogs , "container.image.tag" )
71
74
72
75
expectedEventsLogsFile := "testdata/expected_k8sevents.yaml"
73
76
expectedEventsLogs , err := golden .ReadLogs (expectedEventsLogsFile )
@@ -96,7 +99,7 @@ func Test_K8SEvents(t *testing.T) {
96
99
k8sObjectsLogs = updateLogRecordBody (k8sObjectsLogs , []string {"object" , "metadata" , "resourceVersion" }, "85980" )
97
100
k8sObjectsLogs = updateLogRecordBody (k8sObjectsLogs , []string {"object" , "metadata" , "creationTimestamp" }, "2025-03-04T01:59:10Z" )
98
101
k8sObjectsLogs = updateLogRecordBody (k8sObjectsLogs , []string {"object" , "metadata" , "managedFields" , "0" , "time" }, "2025-03-04T01:59:10Z" )
99
- // k8sObjectsLogs = updateLogRecordBody(k8sObjectsLogs, []string{"object", "metadata", "managedFields", "0", "manager"}, "functional_test .test")
102
+ k8sObjectsLogs = updateLogRecordBody (k8sObjectsLogs , []string {"object" , "metadata" , "managedFields" , "0" , "manager" }, "k8sevents .test" ) // changes when the test name which runs k8s client changes
100
103
101
104
expectedObjectsLogsFile := "testdata/expected_k8sobjects.yaml"
102
105
expectedObjectsLogs , err := golden .ReadLogs (expectedObjectsLogsFile )
0 commit comments