Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e logging: Hard to find errors in test log #1595

Open
nirs opened this issue Oct 21, 2024 · 0 comments · May be fixed by #1596
Open

e2e logging: Hard to find errors in test log #1595

nirs opened this issue Oct 21, 2024 · 0 comments · May be fixed by #1596
Assignees
Labels
bug Something isn't working test Testing related issue

Comments

@nirs
Copy link
Member

nirs commented Oct 21, 2024

Errors during test are logged without ERROR prefix, making it hard to find the issue when a test fails.

=== RUN   TestSuites/Exhaustive/Deploy-rbd/Subscr/Relocate
2024-10-21T23:56:25.454+0530	INFO	dractions/actions.go:135	enter Relocate subscr-deploy-rbd-busybox
2024-10-21T23:56:25.469+0530	INFO	dractions/retry.go:67	drpc subscr-deploy-rbd-busybox is ready
2024-10-21T23:56:25.532+0530	INFO	dractions/actions.go:192	update drpc subscr-deploy-rbd-busybox relocate to rdr-dr2
    actions_test.go:53: Operation cannot be fulfilled on drplacementcontrols.ramendr.openshift.io "subscr-deploy-rbd-busybox": the object has been modified; please apply your changes to the latest version and try again
=== NAME  TestSuites/Exhaustive/Deploy-rbd/Subscr
    exhaustive_suite_test.go:93: Relocate failed

The issue is in go testing package - t.Error/Fatal do not log any prefix. This works for simple tests that do not log anything, but not for complex tests that have lot of logs.

@nirs nirs added bug Something isn't working test Testing related issue labels Oct 21, 2024
@nirs nirs changed the title e2e logging: errors logged as INFO level or without any level e2e logging: Hard to find errors in test log Oct 21, 2024
@nirs nirs linked a pull request Oct 28, 2024 that will close this issue
@nirs nirs self-assigned this Oct 28, 2024
nirs added a commit to nirs/ramen that referenced this issue Oct 30, 2024
When a test fails, we the go test framework logs the failure in an
unhelpful way. This works for unit tests, since they are simple and do
not log anything, but our tests are complex and log a lot. The failure
logs from go test are hidden and hard to find.

This change add wrappers for t.Fatal, t.FailNow, t.Skip, and t.Skipf so
they use our logger instead of the go test framework logger. This
ensures that every failure will have a proper ERROR log which is very
easy to find.

When handling errors in parent tests we don't have any context and we
cannot log any useful error. The actual error that failed the sub test
already logged the error, so we just mark the test as failed with
util.FailNow().

Part-of: RamenDR#1595
Signed-off-by: Nir Soffer <[email protected]>
nirs added a commit to nirs/ramen that referenced this issue Oct 30, 2024
When a test fails, we the go test framework logs the failure in an
unhelpful way. This works for unit tests, since they are simple and do
not log anything, but our tests are complex and log a lot. The failure
logs from go test are hidden and hard to find.

This change add wrappers for t.Fatal, t.FailNow, t.Skip, and t.Skipf so
they use our logger instead of the go test framework logger. This
ensures that every failure will have a proper ERROR log which is very
easy to find. Errors logs include a traceback making it easier to
understand the failure.

When handling errors in parent tests we don't have any context and we
cannot log any useful error. The actual error that failed the sub test
already logged the error, so we just mark the test as failed with
util.FailNow().

Part-of: RamenDR#1595
Signed-off-by: Nir Soffer <[email protected]>
nirs added a commit to nirs/ramen that referenced this issue Oct 30, 2024
When a test fails, we the go test framework logs the failure in an
unhelpful way. This works for unit tests, since they are simple and do
not log anything, but our tests are complex and log a lot. The failure
logs from go test are hidden and hard to find.

This change add wrappers for t.Fatal, t.FailNow, t.Skip, and t.Skipf so
they use our logger instead of the go test framework logger. This
ensures that every failure will have a proper ERROR log which is very
easy to find. Errors logs include a traceback making it easier to
understand the failure.

When handling errors in parent tests we don't have any context and we
cannot log any useful error. The actual error that failed the sub test
already logged the error, so we just mark the test as failed with
util.FailNow().

Fixes: RamenDR#1595
Signed-off-by: Nir Soffer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test Testing related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant