add extension to disabel when not sql compat

This commit is contained in:
Zoltan Haindrich 2024-06-20 14:40:44 +00:00
parent 604910cead
commit ebb27cf462
3 changed files with 48 additions and 5 deletions

View File

@ -36,7 +36,6 @@ import org.apache.druid.java.util.common.RE;
import org.apache.druid.java.util.common.StringUtils; import org.apache.druid.java.util.common.StringUtils;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.condition.EnabledIf;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
@ -78,13 +77,10 @@ import static org.junit.jupiter.api.Assertions.fail;
* *
*/ */
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@EnabledIf(value = "enabled", disabledReason = "These tests are only run in SqlCompatible mode!")
public abstract class DruidQuidemTestBase public abstract class DruidQuidemTestBase
{ {
public static boolean enabled() static {
{
NullHandling.initializeForTests(); NullHandling.initializeForTests();
return NullHandling.sqlCompatible();
} }
public static final String IQ_SUFFIX = ".iq"; public static final String IQ_SUFFIX = ".iq";

View File

@ -0,0 +1,43 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.druid.quidem;
import org.apache.druid.common.config.NullHandling;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;
public class EnabledOnlyInSqlCompatibleMode implements ExecutionCondition
{
static {
NullHandling.initializeForTests();
}
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context)
{
if (NullHandling.sqlCompatible()) {
return ConditionEvaluationResult.enabled("SQL compatible mode is enabled");
} else {
return ConditionEvaluationResult.disabled("SQL compatible mode is disabled");
}
}
}

View File

@ -19,8 +19,12 @@
package org.apache.druid.quidem; package org.apache.druid.quidem;
import org.junit.jupiter.api.extension.ExtendWith;
import java.io.File; import java.io.File;
//@EnabledIf(value = "enabled", disabledReason = "These tests are only run in SqlCompatible mode!")
@ExtendWith(EnabledOnlyInSqlCompatibleMode.class)
public class SqlQuidemTest extends DruidQuidemTestBase public class SqlQuidemTest extends DruidQuidemTestBase
{ {
public SqlQuidemTest() public SqlQuidemTest()