Skip to content

Commit

Permalink
Disable quarkus-full-microprofile dependent tests
Browse files Browse the repository at this point in the history
Works around
#223 to get CI
passing till it gets fixed.
  • Loading branch information
zakkak committed Nov 20, 2023
1 parent b8a857a commit 5338654
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.graalvm.tests.integration.utils.GDBSession;
import org.graalvm.tests.integration.utils.Logs;
import org.graalvm.tests.integration.utils.WebpageTester;
import org.graalvm.tests.integration.utils.versions.IfQuarkusVersion;
import org.graalvm.tests.integration.utils.versions.QuarkusVersion;
import org.graalvm.tests.integration.utils.versions.UsedVersion;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -206,6 +207,7 @@ public void debugSymbolsSmokeGDB(TestInfo testInfo) throws IOException, Interrup
@Test
@Tag("debugSymbolsQuarkus")
@DisabledOnOs({OS.WINDOWS})
@IfQuarkusVersion(max = "3.5.999")
public void debugSymbolsQuarkus(TestInfo testInfo) throws IOException, InterruptedException {
final Apps app = Apps.DEBUG_QUARKUS_FULL_MICROPROFILE;
LOGGER.info("Testing app: " + app);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.graalvm.tests.integration.utils.Uploader;
import org.graalvm.tests.integration.utils.WebpageTester;
import org.graalvm.tests.integration.utils.versions.IfMandrelVersion;
import org.graalvm.tests.integration.utils.versions.IfQuarkusVersion;
import org.graalvm.tests.integration.utils.versions.UsedVersion;
import org.jboss.logging.Logger;
import org.jboss.resteasy.spi.HttpResponseCodes;
Expand Down Expand Up @@ -397,6 +398,7 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx

@Test
@IfMandrelVersion(min = "21.3")
@IfQuarkusVersion(max = "3.5.999")
public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, InterruptedException, URISyntaxException {
final Apps app = Apps.QUARKUS_FULL_MICROPROFILE_PERF;
LOGGER.info("Testing app: " + app);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.graalvm.tests.integration.utils.LogBuilder;
import org.graalvm.tests.integration.utils.Logs;
import org.graalvm.tests.integration.utils.WebpageTester;
import org.graalvm.tests.integration.utils.versions.IfQuarkusVersion;
import org.graalvm.tests.integration.utils.versions.UsedVersion;
import org.jboss.logging.Logger;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -177,6 +178,7 @@ public void testRuntime(TestInfo testInfo, Apps app, Map<String, String> switchR

@Test
@Tag("quarkus")
@IfQuarkusVersion(max = "3.5.999")
public void quarkusFullMicroProfile(TestInfo testInfo) throws IOException, InterruptedException {
Apps app = Apps.QUARKUS_FULL_MICROPROFILE;
final Map<String, String> switches;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2023, Red Hat Inc. All rights reserved.
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.graalvm.tests.integration.utils.versions;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Closed interval from min to max.
* <p>
* e.g. closed interval [3.2.0, 3.6.1], as in 3.2.0 <= QUARKUS_VERSION <= 3.6.1
* translates to @IfQuarkusVersion(min = "3.2.0", max="3.6.1").
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@ExtendWith(QuarkusVersionCondition.class)
@Test
public @interface IfQuarkusVersion {
String min() default "";

String max() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2023, Red Hat Inc. All rights reserved.
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.graalvm.tests.integration.utils.versions;

import org.graalvm.tests.integration.utils.Commands;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;

import java.lang.reflect.AnnotatedElement;

import static java.lang.String.format;
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation;

public class QuarkusVersionCondition implements ExecutionCondition {

private static final ConditionEvaluationResult ENABLED_BY_DEFAULT =
enabled("@IfQuarkusVersion is not present");

@Override
public ConditionEvaluationResult evaluateExecutionCondition(
ExtensionContext context) {
AnnotatedElement element = context
.getElement()
.orElseThrow(IllegalStateException::new);
return findAnnotation(element, IfQuarkusVersion.class)
.map(annotation -> disableIfVersionMismatch(annotation, element))
.orElse(ENABLED_BY_DEFAULT);
}

private ConditionEvaluationResult disableIfVersionMismatch(IfQuarkusVersion annotation, AnnotatedElement element) {
QuarkusVersion usedVersion = Commands.QUARKUS_VERSION;
final boolean quarkusConstraintSatisfied =
(annotation.min().isBlank() || usedVersion.compareTo(new QuarkusVersion(annotation.min())) >= 0) &&
(annotation.max().isBlank() || usedVersion.compareTo(new QuarkusVersion(annotation.max())) <= 0);
if (quarkusConstraintSatisfied) {
return enabled(format(
"%s is enabled as Quarkus version %s does satisfy constraints: min: %s, max: %s",
element, usedVersion, annotation.min(), annotation.max()));
}
return disabled(format(
"%s is disabled as Quarkus version %s does not satisfy constraints: min: %s, max: %s",
element, usedVersion, annotation.min(), annotation.max()));
}
}

0 comments on commit 5338654

Please sign in to comment.