Search in sources :

Example 6 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi by strimzi.

the class FeatureGatesTest method testDuplicateFeatureGateWithDifferentValue.

@ParallelTest
public void testDuplicateFeatureGateWithDifferentValue() {
    InvalidConfigurationException e = assertThrows(InvalidConfigurationException.class, () -> new FeatureGates("+ControlPlaneListener,-ControlPlaneListener"));
    assertThat(e.getMessage(), containsString("Feature gate ControlPlaneListener is configured multiple times"));
}
Also used : InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 7 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi-kafka-operator by strimzi.

the class ClusterOperatorConfigTest method testInvalidCustomResourceSelectorLabels.

@Test
public void testInvalidCustomResourceSelectorLabels() {
    Map<String, String> envVars = new HashMap<>(ClusterOperatorConfigTest.ENV_VARS);
    envVars.put(ClusterOperatorConfig.STRIMZI_CUSTOM_RESOURCE_SELECTOR, "nsLabelKey1,nsLabelKey2");
    InvalidConfigurationException e = assertThrows(InvalidConfigurationException.class, () -> ClusterOperatorConfig.fromMap(envVars, KafkaVersionTestUtils.getKafkaVersionLookup()));
    assertThat(e.getMessage(), containsString("Failed to parse labels from STRIMZI_CUSTOM_RESOURCE_SELECTOR"));
}
Also used : HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) Test(org.junit.jupiter.api.Test)

Example 8 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi-kafka-operator by strimzi.

the class ClusterOperatorConfigTest method testInvalidFeatureGate.

@Test
public void testInvalidFeatureGate() {
    Map<String, String> envVars = new HashMap<>(ClusterOperatorConfigTest.ENV_VARS);
    envVars.put(ClusterOperatorConfig.STRIMZI_FEATURE_GATES, "-NonExistingGate");
    InvalidConfigurationException e = assertThrows(InvalidConfigurationException.class, () -> ClusterOperatorConfig.fromMap(envVars, KafkaVersionTestUtils.getKafkaVersionLookup()));
    assertThat(e.getMessage(), containsString("Unknown feature gate NonExistingGate found in the configuration"));
}
Also used : HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) Test(org.junit.jupiter.api.Test)

Example 9 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi-kafka-operator by strimzi.

the class ClusterOperatorConfigTest method testInvalidOperatorNamespaceLabels.

@Test
public void testInvalidOperatorNamespaceLabels() {
    Map<String, String> envVars = new HashMap<>(ClusterOperatorConfigTest.ENV_VARS);
    envVars.put(ClusterOperatorConfig.STRIMZI_OPERATOR_NAMESPACE_LABELS, "nsLabelKey1,nsLabelKey2");
    InvalidConfigurationException e = assertThrows(InvalidConfigurationException.class, () -> ClusterOperatorConfig.fromMap(envVars, KafkaVersionTestUtils.getKafkaVersionLookup()));
    assertThat(e.getMessage(), containsString("Failed to parse labels from STRIMZI_OPERATOR_NAMESPACE_LABELS"));
}
Also used : HashMap(java.util.HashMap) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) Test(org.junit.jupiter.api.Test)

Example 10 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi-kafka-operator by strimzi.

the class FeatureGatesTest method testDuplicateFeatureGateWithDifferentValue.

@ParallelTest
public void testDuplicateFeatureGateWithDifferentValue() {
    InvalidConfigurationException e = assertThrows(InvalidConfigurationException.class, () -> new FeatureGates("+ControlPlaneListener,-ControlPlaneListener"));
    assertThat(e.getMessage(), containsString("Feature gate ControlPlaneListener is configured multiple times"));
}
Also used : InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

InvalidConfigurationException (io.strimzi.operator.common.InvalidConfigurationException)26 ParallelTest (io.strimzi.test.annotations.ParallelTest)10 HashMap (java.util.HashMap)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 Test (org.junit.jupiter.api.Test)8 NoImageException (io.strimzi.operator.cluster.model.NoImageException)4 UnsupportedVersionException (io.strimzi.operator.cluster.model.UnsupportedVersionException)4 Labels (io.strimzi.operator.common.model.Labels)4 KafkaVersion (io.strimzi.operator.cluster.model.KafkaVersion)2 Collections.emptyMap (java.util.Collections.emptyMap)2 Map (java.util.Map)2 Properties (java.util.Properties)2