use of io.fabric8.arquillian.kubernetes.event.Start in project strimzi by strimzi.
the class ControllerIT method setup.
@Before
public void setup(TestContext context) throws Exception {
LOGGER.info("Setting up test");
Runtime.getRuntime().addShutdownHook(kafkaHook);
kafkaCluster = new KafkaCluster();
kafkaCluster.addBrokers(1);
kafkaCluster.deleteDataPriorToStartup(true);
kafkaCluster.deleteDataUponShutdown(true);
kafkaCluster.usingDirectory(Files.createTempDirectory("controller-integration-test").toFile());
kafkaCluster.startup();
kubeClient = new DefaultKubernetesClient().inNamespace(NAMESPACE);
LOGGER.info("Using namespace {}", NAMESPACE);
Map<String, String> m = new HashMap();
m.put(Config.KAFKA_BOOTSTRAP_SERVERS.key, kafkaCluster.brokerList());
m.put(Config.ZOOKEEPER_CONNECT.key, "localhost:" + zkPort(kafkaCluster));
m.put(Config.NAMESPACE.key, NAMESPACE);
session = new Session(kubeClient, new Config(m));
Async async = context.async();
vertx.deployVerticle(session, ar -> {
if (ar.succeeded()) {
deploymentId = ar.result();
adminClient = session.adminClient;
topicsConfigWatcher = session.topicConfigsWatcher;
topicWatcher = session.topicWatcher;
topicsWatcher = session.topicsWatcher;
async.complete();
} else {
context.fail("Failed to deploy session");
}
});
async.await();
waitFor(context, () -> this.topicsWatcher.started(), timeout, "Topics watcher not started");
waitFor(context, () -> this.topicsConfigWatcher.started(), timeout, "Topic configs watcher not started");
waitFor(context, () -> this.topicWatcher.started(), timeout, "Topic watcher not started");
// We can't delete events, so record the events which exist at the start of the test
// and then waitForEvents() can ignore those
preExistingEvents = kubeClient.events().inNamespace(NAMESPACE).withLabels(cmPredicate.labels()).list().getItems().stream().map(evt -> evt.getMetadata().getUid()).collect(Collectors.toSet());
LOGGER.info("Finished setting up test");
}
use of io.fabric8.arquillian.kubernetes.event.Start in project vertx-openshift-it by cescoffier.
the class HealthCheckIT method testReadinessIsPresent.
@Test
public void testReadinessIsPresent() throws Exception {
final List<Container> containers = getContainers();
ensureThat("the readiness probe is configured correctly", () -> {
containers.forEach(c -> {
Probe readinessProbe = c.getReadinessProbe();
assertThat(readinessProbe).as("Readiness probe should not be null.").isNotNull();
softly.assertThat(readinessProbe.getHttpGet().getPort().getIntVal()).as("port should be defined for readiness probe").isEqualTo(8088);
softly.assertThat(readinessProbe.getHttpGet().getPath()).as("path should be defined for readiness probe").isEqualTo("/start");
});
});
}
use of io.fabric8.arquillian.kubernetes.event.Start in project flink by apache.
the class Fabric8FlinkKubeClient method createTaskManagerPod.
@Override
public CompletableFuture<Void> createTaskManagerPod(KubernetesPod kubernetesPod) {
return CompletableFuture.runAsync(() -> {
final Deployment masterDeployment = this.internalClient.apps().deployments().withName(KubernetesUtils.getDeploymentName(clusterId)).get();
if (masterDeployment == null) {
throw new RuntimeException("Failed to find Deployment named " + clusterId + " in namespace " + this.namespace);
}
// Note that we should use the uid of the master Deployment for the
// OwnerReference.
setOwnerReference(masterDeployment, Collections.singletonList(kubernetesPod.getInternalResource()));
LOG.debug("Start to create pod with spec {}{}", System.lineSeparator(), KubernetesUtils.tryToGetPrettyPrintYaml(kubernetesPod.getInternalResource()));
this.internalClient.pods().create(kubernetesPod.getInternalResource());
}, kubeClientExecutorService);
}
use of io.fabric8.arquillian.kubernetes.event.Start in project zeppelin by apache.
the class K8sRemoteInterpreterProcess method start.
@Override
public void start(String userName) throws IOException {
Properties templateProperties = getTemplateBindings(userName);
// create new pod
apply(specTemplates, false, templateProperties);
// special handling if we doesn't want timeout the process during lifecycle phase pending
if (!timeoutDuringPending) {
// WATCH
PodPhaseWatcher podWatcher = new PodPhaseWatcher(phase -> StringUtils.equalsAnyIgnoreCase(phase, "Succeeded", "Failed", "Running"));
try (Watch watch = client.pods().inNamespace(interpreterNamespace).withName(podName).watch(podWatcher)) {
podWatcher.getCountDownLatch().await();
} catch (InterruptedException e) {
LOGGER.error("Interrupt received during waiting for Running phase. Try to stop the interpreter and interrupt the current thread.", e);
processStopped("Start process was interrupted during waiting for Running phase");
stop();
Thread.currentThread().interrupt();
}
}
long startTime = System.currentTimeMillis();
long timeoutTime = startTime + getConnectTimeout();
// wait until interpreter send started message through thrift rpc
synchronized (started) {
while (!started.get() && !Thread.currentThread().isInterrupted()) {
long timeToTimeout = timeoutTime - System.currentTimeMillis();
if (timeToTimeout <= 0) {
processStopped("The start process was aborted while waiting for the interpreter to start. PodPhase before stop: " + getPodPhase());
stop();
throw new IOException("Launching zeppelin interpreter on kubernetes is time out, kill it now");
}
try {
started.wait(timeToTimeout);
} catch (InterruptedException e) {
LOGGER.error("Interrupt received during started wait. Try to stop the interpreter and interrupt the current thread.", e);
processStopped("The start process was interrupted while waiting for the interpreter to start. PodPhase before stop: " + getPodPhase());
stop();
Thread.currentThread().interrupt();
}
}
}
}
use of io.fabric8.arquillian.kubernetes.event.Start in project docker-maven-plugin by fabric8io.
the class LogMatchCallbackTest method matchingSingleLineSucceeds.
@Test(expected = LogCallback.DoneException.class)
public void matchingSingleLineSucceeds() throws Exception {
final String patternString = "The start has finished right now";
final LogMatchCallback logMatchCallback = new LogMatchCallback(logger, callback, patternString);
new Expectations() {
{
callback.matched();
times = 1;
}
};
logMatchCallback.log(1, new Timestamp(), patternString);
}
Aggregations