Skip to content

Commit

Permalink
Merge branch 'main' into fix-await-image
Browse files Browse the repository at this point in the history
  • Loading branch information
skhalash authored Oct 18, 2024
2 parents 79d81c2 + f8a343d commit f92f9cf
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 280 deletions.
2 changes: 1 addition & 1 deletion test/e2e/logs_dedot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
ContainLd(ContainLogRecord(WithKubernetesLabels(HaveKeyWithValue("dedot_label", "logging-dedot-value")))),
HaveFlatLogs(ContainElement(HaveKubernetesLabels(HaveKeyWithValue("dedot_label", "logging-dedot-value")))),
))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/logs_drop_labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backendExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ContainLd(ContainLogRecord(
WithKubernetesLabels(HaveKeyWithValue("env", "dev")))),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(
ContainElement(HaveKubernetesLabels(HaveKeyWithValue("env", "dev")))),
))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand All @@ -98,8 +98,8 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backendExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(Not(ContainLd(ContainLogRecord(
WithKubernetesAnnotations(Not(BeEmpty()))))),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(Not(ContainElement(
HaveKubernetesAnnotations(Not(BeEmpty()))))),
))
}, periodic.TelemetryConsistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/logs_exclude_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backendExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ContainLd(WithLogRecords(Not(BeEmpty())))))
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(Not(BeEmpty()))))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})

Expand All @@ -98,9 +98,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
defer resp.Body.Close()
g.Expect(err).NotTo(HaveOccurred())
g.Expect(bodyContent).To(Not(BeEmpty()), "No logs found in the backend")
g.Expect(bodyContent).To(Not(ContainLd(ContainLogRecord(
WithContainerName(ContainSubstring(loggen.DefaultName)))),
))
g.Expect(bodyContent).To(HaveFlatLogs(Not(ContainElement(
HaveContainerName(ContainSubstring(loggen.DefaultName)),
))))
}, periodic.TelemetryConsistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
})
Expand Down
9 changes: 5 additions & 4 deletions test/e2e/logs_keep_annotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backendExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ContainLd(ContainLogRecord(
WithKubernetesAnnotations(HaveKeyWithValue("release", "v1.0.0")))),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(
ContainElement(HaveKubernetesAnnotations(HaveKeyWithValue("release", "v1.0.0"))),
),
))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand All @@ -96,8 +97,8 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backendExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(Not(ContainLd(ContainLogRecord(
WithKubernetesLabels(Not(BeEmpty()))))),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(Not(ContainElement(
HaveKubernetesLabels(Not(BeEmpty()))))),
))
}, periodic.TelemetryConsistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/logs_keep_original_body_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backend1ExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ConsistOfLds(ConsistOfLogRecords(
WithLogBody(BeEmpty()),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(HaveEach(
HaveLogBody(BeEmpty()),
))))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand All @@ -118,8 +118,8 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backend2ExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ConsistOfLds(ConsistOfLogRecords(
WithLogBody(Not(BeEmpty())),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(HaveEach(
HaveLogBody(Not(BeEmpty())),
))))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand Down
23 changes: 12 additions & 11 deletions test/e2e/logs_multi_pipeline_namespace_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backendIncludeNamespaceExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
ContainLd(ContainLogRecord(WithNamespace(Equal(mock1Ns)))),
))
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(ContainElement(
HaveNamespace(Equal(mock1Ns)),
))))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})

Expand All @@ -110,9 +110,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backendIncludeNamespaceExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(Not(ContainLd(ContainLogRecord(
WithNamespace(Equal(mock2Ns))))),
))
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(Not(ContainElement(
HaveNamespace(Equal(mock2Ns)),
)))))
}, periodic.TelemetryConsistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
})

Expand All @@ -121,8 +121,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backend2ExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
ContainLd(ContainLogRecord(WithNamespace(Equal(mock2Ns)))),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(ContainElement(
HaveNamespace(Equal(mock2Ns)),
)),
))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand All @@ -132,9 +133,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelLogs), Ordered, func() {
resp, err := proxyClient.Get(backend2ExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(Not(ContainLd(ContainLogRecord(
WithNamespace(Equal(mock1Ns))))),
))
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(Not(ContainElement(
HaveNamespace(Equal(mock1Ns)),
)))))
}, periodic.TelemetryConsistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/logs_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ Types user:string pass:string`
resp, err := proxyClient.Get(backendExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ContainLd(ContainLogRecord(SatisfyAll(
WithLogRecordAttrs(HaveKeyWithValue("user", "foo")),
WithLogRecordAttrs(HaveKeyWithValue("pass", "bar")),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(ContainElement(SatisfyAll(
HaveLogRecordAttributes(HaveKeyWithValue("user", "foo")),
HaveLogRecordAttributes(HaveKeyWithValue("pass", "bar")),
)))))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/overrides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetry), Ordered, func() {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
ContainLd(ContainLogRecord(SatisfyAll(
WithPodName(ContainSubstring("telemetry-manager")),
WithLevel(Equal("INFO")),
HaveFlatLogs(ContainElement(SatisfyAll(
HavePodName(ContainSubstring("telemetry-manager")),
HaveLevel(Equal("INFO")),
))),
))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
Expand All @@ -141,10 +141,10 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetry), Ordered, func() {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
Not(ContainLd(ContainLogRecord(SatisfyAll(
WithPodName(ContainSubstring("telemetry-manager")),
WithLevel(Equal("DEBUG")),
WithTimestamp(BeTemporally(">=", now)),
HaveFlatLogs(Not(ContainElement(SatisfyAll(
HavePodName(ContainSubstring("telemetry-manager")),
HaveLevel(Equal("DEBUG")),
HaveTimestamp(BeTemporally(">=", now)),
)))),
))
}, periodic.TelemetryConsistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
Expand Down Expand Up @@ -177,10 +177,10 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetry), Ordered, func() {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
ContainLd(ContainLogRecord(SatisfyAll(
WithPodName(ContainSubstring("telemetry-manager")),
WithLevel(Equal("DEBUG")),
WithTimestamp(BeTemporally(">=", now)),
HaveFlatLogs(ContainElement(SatisfyAll(
HavePodName(ContainSubstring("telemetry-manager")),
HaveLevel(Equal("DEBUG")),
HaveTimestamp(BeTemporally(">=", now)),
))),
))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
Expand Down
20 changes: 10 additions & 10 deletions test/e2e/telemetry_logs_analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetryLogAnalysis), Ordered, fu
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
Not(ContainLd(ContainLogRecord(SatisfyAll(
WithPodName(ContainSubstring("telemetry-")),
WithLevel(MatchRegexp(logLevelsRegexp)),
WithLogBody(Not( // whitelist possible (flaky/expected) errors
HaveFlatLogs(Not(ContainElement(SatisfyAll(
HavePodName(ContainSubstring("telemetry-")),
HaveLevel(MatchRegexp(logLevelsRegexp)),
HaveLogBody(Not( // whitelist possible (flaky/expected) errors
Or(
ContainSubstring("grpc: addrConn.createTransport failed to connect"),
ContainSubstring("rpc error: code = Unavailable desc = no healthy upstream"),
Expand All @@ -232,9 +232,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetryLogAnalysis), Ordered, fu
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
Not(ContainLd(ContainLogRecord(SatisfyAll(
WithPodName(ContainSubstring("telemetry-")),
WithLogBody(MatchRegexp(logLevelsRegexp)), // fluenbit does not log in JSON, so we need to check the body for errors
HaveFlatLogs(Not(ContainElement(SatisfyAll(
HavePodName(ContainSubstring("telemetry-")),
HaveLogBody(MatchRegexp(logLevelsRegexp)), // fluenbit does not log in JSON, so we need to check the body for errors
)))),
))
}, consistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
Expand All @@ -246,9 +246,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetryLogAnalysis), Ordered, fu
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(
Not(ContainLd(ContainLogRecord(SatisfyAll(
WithPodName(ContainSubstring("telemetry-")),
WithLevel(MatchRegexp(logLevelsRegexp)),
HaveFlatLogs(Not(ContainElement(SatisfyAll(
HavePodName(ContainSubstring("telemetry-")),
HaveLevel(MatchRegexp(logLevelsRegexp)),
)))),
))
}, consistentlyTimeout, periodic.TelemetryInterval).Should(Succeed())
Expand Down
4 changes: 2 additions & 2 deletions test/integration/istio/access_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ var _ = Describe(suite.ID(), Label(suite.LabelIntegration), Ordered, func() {
resp, err := proxyClient.Get(backendExportURL)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ContainLd(ContainLogRecord(
WithLogRecordAttrs(HaveKey(BeElementOf(istio.AccessLogAttributeKeys))),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(ContainElement(
HaveLogRecordAttributes(HaveKey(BeElementOf(istio.AccessLogAttributeKeys))),
))))
}, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
})
Expand Down
4 changes: 2 additions & 2 deletions test/testkit/assert/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func LogsDelivered(proxyClient *apiserverproxy.Client, expectedPodNamePrefix str
g.Expect(err).NotTo(HaveOccurred())
defer resp.Body.Close()
g.Expect(resp).To(HaveHTTPStatus(http.StatusOK))
g.Expect(resp).To(HaveHTTPBody(ContainLd(ContainLogRecord(
WithPodName(ContainSubstring(expectedPodNamePrefix))),
g.Expect(resp).To(HaveHTTPBody(HaveFlatLogs(ContainElement(
HavePodName(ContainSubstring(expectedPodNamePrefix))),
)))
}, periodic.EventuallyTimeout, periodic.TelemetryInterval).Should(Succeed())
}
Expand Down
Loading

0 comments on commit f92f9cf

Please sign in to comment.