Address java.lang.NoClassDefFoundError
in DefaultClassFilterTest
Through Fixed Order-Dependent Test Execution
#706
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Address
java.lang.NoClassDefFoundError
inDefaultClassFilterTest
Through Fixed Order-Dependent Test ExecutionDescription
When executing the test
DefaultClassFilterTest.testDefaultsAreUsedIfOverridesAreGarbage
, the intention is to verify the error message when attempting to create aClassFilter
instance with invalid overrides. However, running this test prior to others that rely on theClassFilter
class may lead to ajava.lang.NoClassDefFoundError
. This error suggests that the JVM previously failed to load the class from the classpath, and subsequently, it won't attempt to load it again, resulting in the error.To resolve this issue, it is advisable to initialize the
ClassFilter
successfully before running the specified test. By doing so, the class will be loaded successfully, and subsequent tests can proceed without encountering theNoClassDefFoundError
. This sequential approach ensures proper class loading and eliminates the error.remoting/src/test/java/hudson/remoting/DefaultClassFilterTest.java
Line 101 in 1e88c50
For these tests, we detected they are Order-Dependent tests by using iDFlakies tool
hudson.remoting.ClassFilterTest.transport_chunking
hudson.remoting.ClassFilterTest.transport_nio
hudson.remoting.ClassFilterTest.transport_non_chunking
hudson.remoting.ClassFilterTest.userRequest
hudson.remoting.ClassFilterTest.userRequest_singleClassLoader
hudson.remoting.DefaultClassFilterTest.testDefaultsNoOverride
hudson.remoting.DefaultClassFilterTest.testDefaultsOverrideExists
hudson.remoting.DiagnosedStreamCorruptionExceptionTest.blockingStreamShouldNotPreventDiagnosis
hudson.remoting.DiagnosedStreamCorruptionExceptionTest.exercise
And we also run the script to find out that the polluter (the test that runs before the test that causes these test to fail) is:
hudson.remoting.DefaultClassFilterTest.testDefaultsAreUsedIfOverridesAreGarbage
Steps to Reproduce:
The following is an example error message from
ClassFilterTest.transport_chunking
Testing done
Submitter checklist