-
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 DisabledOnAarch64Native annotation
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...est-core/src/main/java/io/quarkus/test/scenarios/annotations/DisabledOnAarch64Native.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkus.test.scenarios.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
@Inherited | ||
@Target({ ElementType.TYPE, ElementType.METHOD }) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@ExtendWith(DisabledOnAarch64NativeCondition.class) | ||
public @interface DisabledOnAarch64Native { | ||
/** | ||
* Why is the annotated test class or test method disabled. | ||
*/ | ||
String reason() default ""; | ||
} |
26 changes: 26 additions & 0 deletions
26
...src/main/java/io/quarkus/test/scenarios/annotations/DisabledOnAarch64NativeCondition.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.quarkus.test.scenarios.annotations; | ||
|
||
import org.junit.jupiter.api.extension.ConditionEvaluationResult; | ||
import org.junit.jupiter.api.extension.ExecutionCondition; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
import io.quarkus.test.services.quarkus.model.QuarkusProperties; | ||
|
||
public class DisabledOnAarch64NativeCondition implements ExecutionCondition { | ||
@Override | ||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { | ||
/* | ||
* This only triggers, if test executor is running on aarch64. | ||
* e.g. It doesn't work if test executor is amd64 and targeted OCP cluster is aarch. | ||
* But for native this should not be a problem, since native images has to be built on aarch and then exectued on aarch. | ||
*/ | ||
boolean isAarch64 = System.getProperty("os.arch").toLowerCase().trim().equals("aarch64"); | ||
boolean isNative = QuarkusProperties.isNativeEnabled(); | ||
|
||
if (isAarch64 && isNative) { | ||
return ConditionEvaluationResult.disabled("Skipping test as it's not running on aarch64 native"); | ||
} | ||
|
||
return ConditionEvaluationResult.enabled("Running test as it's running on aarch64 native"); | ||
} | ||
} |