-
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.
Fix remote DEV tests after breaking package config changes
- Loading branch information
1 parent
6b306f7
commit 86930ff
Showing
9 changed files
with
70 additions
and
12 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
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
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
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
41 changes: 41 additions & 0 deletions
41
...kus/test/scenarios/execution/condition/DisableDevModeTestsInNativeExecutionCondition.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,41 @@ | ||
package io.quarkus.test.scenarios.execution.condition; | ||
|
||
import static io.quarkus.test.scenarios.execution.condition.AbstractQuarkusScenarioContainerExecutionCondition.CONDITION_NOT_MATCHED; | ||
import static io.quarkus.test.services.quarkus.model.QuarkusProperties.isNativePackageType; | ||
|
||
import java.lang.reflect.Modifier; | ||
import java.util.Arrays; | ||
|
||
import org.junit.jupiter.api.extension.ConditionEvaluationResult; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
import io.quarkus.test.services.DevModeQuarkusApplication; | ||
import io.quarkus.test.services.RemoteDevModeQuarkusApplication; | ||
|
||
public class DisableDevModeTestsInNativeExecutionCondition implements QuarkusScenarioExecutionCondition { | ||
|
||
@Override | ||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { | ||
return context | ||
.getElement() | ||
.filter(AbstractQuarkusScenarioContainerExecutionCondition::isQuarkusScenario) | ||
.map(clazz -> (Class<?>) clazz) | ||
.map(DisableDevModeTestsInNativeExecutionCondition::evaluate) | ||
.orElse(CONDITION_NOT_MATCHED); | ||
} | ||
|
||
private static ConditionEvaluationResult evaluate(Class<?> testClass) { | ||
if (isNativePackageType() && isDevModeTest(testClass)) { | ||
return ConditionEvaluationResult.disabled("DEV mode tests can't be run when native mode is enabled"); | ||
} else { | ||
return ConditionEvaluationResult.enabled("Not a DEV mode test in native mode"); | ||
} | ||
} | ||
|
||
private static boolean isDevModeTest(Class<?> testClass) { | ||
return Arrays.stream(testClass.getDeclaredFields()) | ||
.filter(m -> Modifier.isStatic(m.getModifiers())) | ||
.anyMatch(m -> m.isAnnotationPresent(RemoteDevModeQuarkusApplication.class) | ||
|| m.isAnnotationPresent(DevModeQuarkusApplication.class)); | ||
} | ||
} |
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
3 changes: 2 additions & 1 deletion
3
.../services/io.quarkus.test.scenarios.execution.condition.QuarkusScenarioExecutionCondition
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 +1,2 @@ | ||
io.quarkus.test.scenarios.execution.condition.AnnotationBindingQuarkusScenarioContainerExecutionCondition | ||
io.quarkus.test.scenarios.execution.condition.AnnotationBindingQuarkusScenarioContainerExecutionCondition | ||
io.quarkus.test.scenarios.execution.condition.DisableDevModeTestsInNativeExecutionCondition |
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
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