Skip to content

Flaky tests: IT dev-test #1633

@bmarwell

Description

@bmarwell

Hi!

Not sure it is related to maybe #1626 (PR not merged yet), but this test will sometimes fail:

DevTest.configIncludesChangeTest():

[INFO] [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ dev-it ---
Warning: ARNING] JAR will be empty - no content was marked for inclusion!
[INFO] [INFO] Building jar: /home/runner/work/ci.maven/ci.maven/liberty-maven-plugin/target/it/dev-it/target/dev-it-1.0-SNAPSHOT.jar
[INFO] [INFO] 
[INFO] [INFO] --- maven-jar-plugin:3.2.2:test-jar (default) @ dev-it ---
[INFO] [INFO] Building jar: /home/runner/work/ci.maven/ci.maven/liberty-maven-plugin/target/it/dev-it/target/dev-it-1.0-SNAPSHOT-tests.jar
[INFO] [INFO] 
[INFO] [INFO] --- maven-failsafe-plugin:3.0.0-M7:integration-test (integration-test) @ dev-it ---
[INFO] [INFO] Using auto detected provider org.apache.maven.surefire.junit4.JUnit4Provider
[INFO] [INFO] 
[INFO] [INFO] -------------------------------------------------------
[INFO] [INFO]  T E S T S
[INFO] [INFO] -------------------------------------------------------
[INFO] [INFO] Running net.wasdev.wlp.test.dev.it.MultiModuleRunInstallEarTest
[INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 52.165 s - in net.wasdev.wlp.test.dev.it.MultiModuleRunInstallEarTest
[INFO] [INFO] Running net.wasdev.wlp.test.dev.it.DevCopyTestDependenciesTest
[INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 26.323 s - in net.wasdev.wlp.test.dev.it.DevCopyTestDependenciesTest
[INFO] [INFO] Running net.wasdev.wlp.test.dev.it.MultipleConcurrentLibertyModulesPlTest
[INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 40.805 s - in net.wasdev.wlp.test.dev.it.MultipleConcurrentLibertyModulesPlTest
[INFO] [INFO] Running net.wasdev.wlp.test.dev.it.MultiModuleRunEjbTest
[INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 40.328 s - in net.wasdev.wlp.test.dev.it.MultiModuleRunEjbTest
[INFO] [INFO] Running net.wasdev.wlp.test.dev.it.MultiModuleHotTestingTest
[INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 61.915 s - in net.wasdev.wlp.test.dev.it.MultiModuleHotTestingTest
[INFO] [INFO] Running net.wasdev.wlp.test.dev.it.DevTest
Error: [ERROR] Tests run: 13, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 127.036 s <<< FAILURE! - in net.wasdev.wlp.test.dev.it.DevTest
Error: [ERROR] net.wasdev.wlp.test.dev.it.DevTest.configIncludesChangeTest  Time elapsed: 23.799 s  <<< FAILURE!

…

[INFO] java.lang.AssertionError
[INFO] 	at org.junit.Assert.fail(Assert.java:87)
[INFO] 	at org.junit.Assert.assertTrue(Assert.java:42)
[INFO] 	at org.junit.Assert.assertTrue(Assert.java:53)
[INFO] 	at net.wasdev.wlp.test.dev.it.DevTest.configIncludesChangeTest(DevTest.java:107)
[INFO] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[INFO] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[INFO] 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)

Line 107 is:

replaceString("<feature>servlet-4.0</feature>", "<!-- replace -->", srcServerXMLIncludes);

Assuming we are looking at the wrong line now.
Looking at the test, it depends on timeouts:

boolean foundUpdate = verifyLogMessageExists("<feature>servlet-4.0</feature>", 60000, targetServerXMLIncludes);

… which is 60 seconds. Maybe you might want to use Awaitility here? It would give you a much nicer exception message "for free"..

It would read to:

      await()
        .atMost(Duration.ofSeconds(60L))
        .until(() -> verifyLogMessageExists("<feature>servlet-4.0</feature>", 10, targetServerXMLIncludes));

(10 ms chosen randomly).

This would help to identify the actual problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions