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

Update the test logging to include the failed assertion #4987

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

dlvenable
Copy link
Member

Description

The current output of failures shows where the assertion failed. But, it does not show what was wrong with the assertion.

For example, we see logs like this:

AbstractSinkTest > testSinkNotReady() FAILED
    org.opentest4j.AssertionFailedError at AbstractSinkTest.java:84

This change outputs the actual cause without adding the whole stack trace either.

Here is some sample code:

public class ForceFail {
    @Test
    void always_fails() {
        assertThat(true, equalTo(false));
    }
}

The logging includes:

> Task :data-prepper-api:test

ForceFail > always_fails() FAILED
    java.lang.AssertionError:
    Expected: <false>
         but: was <true>

1133 tests completed, 1 failed, 2 skipped

Issues Resolved

N/A

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…tigations, especially during CI builds on GitHub Actions.

Signed-off-by: David Venable <[email protected]>
@dlvenable dlvenable added the maintenance Issues to help maintain the project, such as improving builds, testing, etc. label Sep 30, 2024
@dlvenable dlvenable added this to the v2.10 milestone Sep 30, 2024
Copy link
Collaborator

@oeyh oeyh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dlvenable dlvenable merged commit 962750b into opensearch-project:main Oct 7, 2024
72 of 76 checks passed
@dlvenable dlvenable deleted the tests-show-cause branch October 22, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Issues to help maintain the project, such as improving builds, testing, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants