Repository navigation
MINOR: Migrate TestFooterIntegrity to JUnit 5 and AssertJ - #3878
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
TestFooterIntegrity was added in apache#3655 using JUnit 4 (org.junit.Test, Assert.assertFalse and Assert.assertThrows). Test code in this repository must use JUnit 5 and AssertJ, and the enforce-banned-junit4-imports enforcer rule rejects the JUnit 4 imports during process-test-sources. As a result the parquet-hadoop module, and every build that includes it, currently fails on master before any test runs. Switch the test to org.junit.jupiter.api.Test and AssertJ, following agents/docs/writing-tests.md: - assert that the footer's block list is not empty with assertThat(...).isNotEmpty() instead of assertFalse(isEmpty()) - replace assertThrows with assertThatThrownBy, also checking the "Signature mismatch in plaintext footer" message so the test proves the rejection comes from the footer signature check The behavior covered by the test is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rationale for this change
TestFooterIntegrity, added in #3655, uses JUnit 4 (org.junit.Test,Assert.assertFalse,Assert.assertThrows). Theenforce-banned-junit4-importsenforcer rule rejects those imports inprocess-test-sources, soparquet-hadoopand every module built after it fail on master before any test runs. TheCI Hadoop 3workflow has failed on master since ccbc37a.What changes are included in this PR?
Migrate
TestFooterIntegrityto JUnit 5 and AssertJ, followingagents/docs/writing-tests.md:org.junit.Test→org.junit.jupiter.api.TestassertFalse(metaData.getBlocks().isEmpty())→assertThat(metaData.getBlocks()).isNotEmpty()assertThrows(TagVerificationException.class, ...)→assertThatThrownBy(...).isInstanceOf(TagVerificationException.class).hasMessage("Signature mismatch in plaintext footer"). The message check confirms the footer signature check is what rejects the file.The test still covers the same behavior.
Are these changes tested?
Yes, on JDK 17 with Thrift 0.25.0:
./mvnw -pl parquet-hadoop spotless:check test -Dtest=TestFooterIntegrity: both tests pass, and the banned-imports rule passes../mvnw install -DskipTestsacross the whole default reactor: succeeds. On master it fails inparquet-hadoopwithBanned imports detected in TEST code ... TestFooterIntegrity.java.Are there any user-facing changes?
No. Only a test changes.