Skip to content

Commit

Permalink
Warn when BytecodeVersionValidator is ran without limits
Browse files Browse the repository at this point in the history
BytecodeVersionValidator should not be ran in informative mode in
automated tests, where alternative BytecodeVersionJarValidatorJP
should be used instead.  Therefore add a warning issued when
BytecodeVersionValidator is ran in informative mode, which is treated
by test automation as failure.
  • Loading branch information
mizdebsk committed Jan 15, 2025
1 parent 031ab31 commit 9bdfc94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public Limits readLimits() {
public void validate(RpmPackage rpm, Path jarPath, Map<Path, Version> classVersions) {
var limits = readLimits();
if (limits == null) {
warn("No limits were configured for " + getTestName() + ", the results will only be informative.");
super.validate(rpm, jarPath, classVersions);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public static void assertInfo(Result result) {
assertEquals(TestResult.info, result.getResult(), "expected result: INFO");
}

public static void assertWarn(Result result) {
assertEquals(TestResult.warn, result.getResult(), "expected result: WARN");
}

public static void assertFailOne(Result result) {
assertEquals(TestResult.fail, result.getResult(), "expected result: FAIL");
int count = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import static org.fedoraproject.javapackages.validator.TestCommon.assertError;
import static org.fedoraproject.javapackages.validator.TestCommon.assertFailOne;
import static org.fedoraproject.javapackages.validator.TestCommon.assertInfo;
import static org.fedoraproject.javapackages.validator.TestCommon.assertPass;
import static org.fedoraproject.javapackages.validator.TestCommon.assertWarn;
import static org.junit.jupiter.api.Assertions.fail;

import java.nio.file.Path;
Expand Down Expand Up @@ -52,10 +52,11 @@ void assertMsg(String exp) {
}

@Test
void testInfo() throws Exception {
void testInformative() throws Exception {
validator.validate(RPMS, null);
assertInfo(validator.build());
assertWarn(validator.build());
assertMsg("module-info.class: bytecode version: 65.0");
assertMsg("No limits were configured for /java/bytecode-version, the results will only be informative");
}

@Test
Expand Down

0 comments on commit 9bdfc94

Please sign in to comment.