-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add @DisabledOnFipsAndNative & drop version with Java 17
- Loading branch information
1 parent
d1fea78
commit 528f205
Showing
2 changed files
with
9 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
16 changes: 7 additions & 9 deletions
16
...ons/DisabledOnFipsAndJava17Condition.java → ...ons/DisabledOnFipsAndNativeCondition.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
package io.quarkus.test.scenarios.annotations; | ||
|
||
import static io.quarkus.test.services.quarkus.model.QuarkusProperties.isNativeEnabled; | ||
|
||
import org.junit.jupiter.api.extension.ConditionEvaluationResult; | ||
import org.junit.jupiter.api.extension.ExecutionCondition; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
public class DisabledOnFipsAndJava17Condition implements ExecutionCondition { | ||
public class DisabledOnFipsAndNativeCondition implements ExecutionCondition { | ||
|
||
/** | ||
* We set environment variable "FIPS" to "fips" in our Jenkins jobs when FIPS are enabled. | ||
*/ | ||
private static final String FIPS_ENABLED = "fips"; | ||
private static final int JAVA_17 = 17; | ||
|
||
@Override | ||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { | ||
if (isFipsEnabledEnvironment() && isJava17()) { | ||
return ConditionEvaluationResult.disabled("The test is running in FIPS enabled environment with Java 17"); | ||
if (isFipsEnabledEnvironment() && isNativeEnabled()) { | ||
return ConditionEvaluationResult.disabled("The test is running in FIPS enabled environment in native mode"); | ||
} | ||
|
||
return ConditionEvaluationResult.enabled("The test is not running in FIPS enabled environment with Java 17"); | ||
return ConditionEvaluationResult.enabled("The test is not running in FIPS enabled environment in native mode"); | ||
} | ||
|
||
private static boolean isFipsEnabledEnvironment() { | ||
return FIPS_ENABLED.equals(System.getenv().get("FIPS")); | ||
return FIPS_ENABLED.equalsIgnoreCase(System.getenv().get("FIPS")); | ||
} | ||
|
||
private static boolean isJava17() { | ||
return JAVA_17 == Runtime.version().feature(); | ||
} | ||
} |