Skip to content

Run LogSourceTest - #431

Closed
sharanggupta wants to merge 1 commit into
apache:masterfrom
sharanggupta:LogSourceTest-not-run
Closed

sharanggupta wants to merge 1 commit into
apache:masterfrom
sharanggupta:LogSourceTest-not-run

Conversation

@sharanggupta

Copy link
Copy Markdown

LogSourceTest was added together with the deprecation of LogSource.jdk14IsAvailable (e377509), but it has never run, for two reasons:

  • testJdk14IsAvailable() has no @Test annotation. The class uses JUnit 5 assertions and does not extend TestCase, so no engine considers it a test.
  • The tests run with Failsafe, whose integration-test execution only includes **/*TestCase.java, so a class named *Test is not picked up either.

This PR renames the class to LogSourceTestCase, like the other tests, and adds @Test. The test now runs in the integration-test execution and passes. The default Maven goal passes locally.

Before you push a pull request, review this list:

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? Claude (Anthropic) helped find the test that never ran; I reviewed the change and ran the build.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

The test had no @test annotation, and Failsafe only runs classes named
*TestCase, so it never ran. Rename it to LogSourceTestCase and annotate
the test method.
import static org.junit.jupiter.api.Assertions.assertTrue;

public class LogSourceTest {
import org.junit.jupiter.api.Test;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't change the class name.

@garydgregory

Copy link
Copy Markdown
Member

Closing: Already done.

@sharanggupta

Copy link
Copy Markdown
Author

3000acb adds the @Test, but the test still doesn't run: Surefire is skipped and the Failsafe integration-test execution only includes **/*TestCase.java, so LogSourceTest isn't picked up (it's absent from the master CI log for b6d354d). The rename in this PR is what makes it run.

@garydgregory

Copy link
Copy Markdown
Member

Hello @sharanggupta
git master now uses the *Test convention throughout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants