Skip to content

Commit 1b62d6f

Browse files
committed
[chore] update k8sevent for k8s v1.35
1 parent a23715a commit 1b62d6f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

functional_tests/k8sevents/k8sevents_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ func Test_K8SEvents(t *testing.T) {
6464
t.Run("CheckK8SEventsLogs", func(t *testing.T) {
6565
actualLogs := selectResLogs("com.splunk.sourcetype", "kube:events", eventsLogsConsumer)
6666
k8sEventsLogs := selectLogs("k8s.namespace.name", "k8sevents-test", &actualLogs, func(body string) string {
67+
s := body
6768
re := regexp.MustCompile(`Successfully pulled image "(busybox|alpine):latest" in .* \(.* including waiting\).*`)
68-
return re.ReplaceAllString(body, `Successfully pulled image "$1:latest" in <time> (<time> including waiting)`)
69+
s = re.ReplaceAllString(s, `Successfully pulled image "$1:latest" in <time> (<time> including waiting)`)
70+
// Pre-1.35: "Created container: <name>", "Started container <name>". 1.35+: "Container created", "Container started".
71+
s = regexp.MustCompile(`Created container: .*`).ReplaceAllString(s, "Container created")
72+
s = regexp.MustCompile(`Started container( .*)?`).ReplaceAllString(s, "Container started")
73+
return s
6974
})
7075

7176
expectedEventsLogsFile := "testdata/expected_k8sevents.yaml"

functional_tests/k8sevents/testdata/expected_k8sevents.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ resourceLogs:
327327
value:
328328
stringValue: Normal
329329
body:
330-
stringValue: 'Created container: container-1'
330+
stringValue: Container created
331331
timeUnixNano: "1759215210000000000"
332332
- attributes:
333333
- key: deployment.environment
@@ -391,7 +391,7 @@ resourceLogs:
391391
value:
392392
stringValue: Normal
393393
body:
394-
stringValue: Started container container-1
394+
stringValue: Container started
395395
timeUnixNano: "1759215210000000000"
396396
- attributes:
397397
- key: deployment.environment
@@ -583,7 +583,7 @@ resourceLogs:
583583
value:
584584
stringValue: Normal
585585
body:
586-
stringValue: 'Created container: container-2'
586+
stringValue: Container created
587587
timeUnixNano: "1759215213000000000"
588588
- attributes:
589589
- key: deployment.environment
@@ -647,6 +647,6 @@ resourceLogs:
647647
value:
648648
stringValue: Normal
649649
body:
650-
stringValue: Started container container-2
650+
stringValue: Container started
651651
timeUnixNano: "1759215213000000000"
652652
scope: {}

0 commit comments

Comments
 (0)