Search in sources :

Example 11 with InvalidConfigurationException

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

the class FeatureGatesTest method testMissingSign.

@ParallelTest
public void testMissingSign() {
    InvalidConfigurationException e = assertThrows(InvalidConfigurationException.class, () -> new FeatureGates("ControlPlaneListener"));
    assertThat(e.getMessage(), containsString("ControlPlaneListener is not a valid feature gate configuration"));
}
Also used : InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 12 with InvalidConfigurationException

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

the class FeatureGatesTest method testNonExistingGate.

@ParallelTest
public void testNonExistingGate() {
    InvalidConfigurationException e = assertThrows(InvalidConfigurationException.class, () -> new FeatureGates("+RandomGate"));
    assertThat(e.getMessage(), containsString("Unknown feature gate RandomGate found in the configuration"));
}
Also used : InvalidConfigurationException(io.strimzi.operator.common.InvalidConfigurationException) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 13 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi 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 14 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi 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 15 with InvalidConfigurationException

use of io.strimzi.operator.common.InvalidConfigurationException in project strimzi 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)

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