Skip to content

Commit e40d93a

Browse files
committed
feat(tests): add error log checking for operator pod in user tests
1 parent 7315095 commit e40d93a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

e2e/support/test_support.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,6 +2811,8 @@ func userCleanup(t *testing.T) {
28112811

28122812
func invokeUserTestCode(t *testing.T, ctx context.Context, ns string, doRun func(context.Context, *gomega.WithT, string)) {
28132813
defer func() {
2814+
// Check for error logs before deleting the test namespace
2815+
checkOperatorErrorLogs(t, ctx, ns)
28142816
DumpNamespace(t, ctx, ns)
28152817
// Also dump the operator namespace in case it's common
28162818
DumpNamespace(t, ctx, "camel-k")
@@ -2820,6 +2822,11 @@ func invokeUserTestCode(t *testing.T, ctx context.Context, ns string, doRun func
28202822
doRun(ctx, g, ns)
28212823
}
28222824

2825+
func checkOperatorErrorLogs(t *testing.T, ctx context.Context, ns string) {
2826+
g := gomega.NewWithT(t)
2827+
g.Expect(OperatorLogs(t, ctx, ns)).ShouldNot(gomega.ContainSubstring(`"level":"error"`))
2828+
}
2829+
28232830
func deleteKnativeBroker(t *testing.T, ctx context.Context, ns metav1.Object) {
28242831
nsRef := corev1.Namespace{
28252832
TypeMeta: metav1.TypeMeta{

0 commit comments

Comments
 (0)