Skip to content

Commit

Permalink
Add DisabledOnAarch64Native annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
mocenas authored and mjurc committed Oct 10, 2024
1 parent 936f047 commit 73bee03
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
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 "";
}
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");
}
}

0 comments on commit 73bee03

Please sign in to comment.