use of io.fabric8.karaf.checks.Check in project strimzi by strimzi.
the class ControllerTest method testOnConfigMapAdded_ClusterAuthorizationException.
/**
* 1. controller is notified that a ConfigMap is created
* 2. error when creating topic in kafka
*/
@Test
public void testOnConfigMapAdded_ClusterAuthorizationException(TestContext context) {
Exception createException = new ClusterAuthorizationException("");
Controller op = configMapAdded(context, createException, null);
// TODO check a k8s event got created
// TODO what happens when we subsequently reconcile?
}
use of io.fabric8.karaf.checks.Check in project strimzi by strimzi.
the class ControllerTest method testOnConfigMapAdded_TopicExistsException.
/**
* 1. controller is notified that a ConfigMap is created
* 2. error when creating topic in kafka
*/
@Test
public void testOnConfigMapAdded_TopicExistsException(TestContext context) {
Exception createException = new TopicExistsException("");
configMapAdded(context, createException, null);
// TODO check a k8s event got created
// TODO what happens when we subsequently reconcile?
}
use of io.fabric8.karaf.checks.Check in project strimzi by strimzi.
the class OpenShiftTemplatesTest method testStrimziPersistentWithCustomParameters.
@Test
public void testStrimziPersistentWithCustomParameters() throws IOException {
String clusterName = "test-persistent-with-custom-parameters";
oc.newApp("strimzi-persistent", map("CLUSTER_NAME", clusterName, "ZOOKEEPER_HEALTHCHECK_DELAY", "30", "ZOOKEEPER_HEALTHCHECK_TIMEOUT", "10", "KAFKA_HEALTHCHECK_DELAY", "30", "KAFKA_HEALTHCHECK_TIMEOUT", "10", "KAFKA_DEFAULT_REPLICATION_FACTOR", "2", "KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "5", "KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", "5", "ZOOKEEPER_VOLUME_CAPACITY", "2Gi", "KAFKA_VOLUME_CAPACITY", "2Gi"));
// TODO Add assertions to check that Kafka brokers have a custom configuration
ConfigMap cm = client.configMaps().inNamespace(NAMESPACE).withName(clusterName).get();
assertNotNull(cm);
Map<String, String> cmData = cm.getData();
assertEquals("30", cmData.get("zookeeper-healthcheck-delay"));
assertEquals("10", cmData.get("zookeeper-healthcheck-timeout"));
assertEquals("30", cmData.get("kafka-healthcheck-delay"));
assertEquals("10", cmData.get("kafka-healthcheck-timeout"));
assertEquals("2", cmData.get("KAFKA_DEFAULT_REPLICATION_FACTOR"));
assertEquals("5", cmData.get("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR"));
assertEquals("5", cmData.get("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR"));
assertEquals("2Gi", mapper.readTree(cmData.get("kafka-storage")).get("size").asText());
assertEquals("2Gi", mapper.readTree(cmData.get("zookeeper-storage")).get("size").asText());
}
use of io.fabric8.karaf.checks.Check in project flink by apache.
the class KubernetesClusterDescriptorTest method checkUpdatedConfigAndResourceSetting.
private void checkUpdatedConfigAndResourceSetting() {
// Check updated flink config options
assertEquals(String.valueOf(Constants.BLOB_SERVER_PORT), flinkConfig.getString(BlobServerOptions.PORT));
assertEquals(String.valueOf(Constants.TASK_MANAGER_RPC_PORT), flinkConfig.getString(TaskManagerOptions.RPC_PORT));
assertEquals(InternalServiceDecorator.getNamespacedInternalServiceName(CLUSTER_ID, NAMESPACE), flinkConfig.getString(JobManagerOptions.ADDRESS));
final Deployment jmDeployment = kubeClient.apps().deployments().list().getItems().get(0);
final Container jmContainer = jmDeployment.getSpec().getTemplate().getSpec().getContainers().get(0);
assertEquals(String.valueOf(clusterSpecification.getMasterMemoryMB()), jmContainer.getResources().getRequests().get(Constants.RESOURCE_NAME_MEMORY).getAmount());
assertEquals(String.valueOf(clusterSpecification.getMasterMemoryMB()), jmContainer.getResources().getLimits().get(Constants.RESOURCE_NAME_MEMORY).getAmount());
}
use of io.fabric8.karaf.checks.Check in project alluxio by Alluxio.
the class ManagerProcessContext method handleStatusRuntimeException.
private void handleStatusRuntimeException(String message, Throwable t) {
LogUtils.warnWithException(LOG, message, t);
if (Status.fromThrowable(t).getCode() == Status.UNAUTHENTICATED.getCode()) {
if (mLock.tryLock()) {
try {
// shut down the Hub Manager and Agents
String msg = String.format("Shutting down the Hub Agent because the Hub Manager is " + "unauthenticated. Check %s, %s properties in the Hub Manager's " + "alluxio-site.properties.", PropertyKey.Name.HUB_AUTHENTICATION_API_KEY, PropertyKey.Name.HUB_AUTHENTICATION_SECRET_KEY);
AgentShutdownRequest req = AgentShutdownRequest.newBuilder().setLogMessage(msg).setExitCode(401).build();
Function<AgentManagerServiceGrpc.AgentManagerServiceBlockingStub, AgentShutdownResponse> x = (client) -> {
AgentShutdownResponse resp = client.shutdown(req);
return resp;
};
try {
execOnHub(x);
} catch (Exception e) {
LogUtils.warnWithException(LOG, "Failed to call shutdown() on Hub Agent. " + "Continuing with shutting down Hub Manager.", e);
}
} finally {
mLock.unlock();
}
}
LOG.error(String.format("Shutting down the Hub manager because it is unauthenticated. " + "Check %s, %s properties in alluxio-site.properties.", PropertyKey.Name.HUB_AUTHENTICATION_API_KEY, PropertyKey.Name.HUB_AUTHENTICATION_SECRET_KEY));
System.exit(401);
}
}
Aggregations