use of io.fabric8.arquillian.kubernetes.event.Start in project fabric8 by jboss-fuse.
the class AbstractManagedContainer method start.
@Override
public final synchronized void start() throws LifecycleException {
assertNotDestroyed();
try {
if (state == State.CREATED || state == State.STOPPED) {
doStart(configuration);
state = State.STARTED;
}
} catch (Exception ex) {
throw new LifecycleException("Cannot start container", ex);
}
}
use of io.fabric8.arquillian.kubernetes.event.Start in project fabric8-maven-plugin by fabric8io.
the class OpenshiftBuildService method build.
@Override
public void build(ImageConfiguration imageConfig) throws Fabric8ServiceException {
try {
ImageName imageName = new ImageName(imageConfig.getName());
File dockerTar = createBuildArchive(imageConfig);
KubernetesListBuilder builder = new KubernetesListBuilder();
// Check for buildconfig / imagestream and create them if necessary
String buildName = updateOrCreateBuildConfig(config, client, builder, imageConfig);
checkOrCreateImageStream(config, client, builder, getImageStreamName(imageName));
applyResourceObjects(config, client, builder);
// Start the actual build
Build build = startBuild(client, dockerTar, buildName);
// Wait until the build finishes
waitForOpenShiftBuildToComplete(client, build);
// Create a file with generated image streams
addImageStreamToFile(getImageStreamFile(config), imageName, client);
} catch (Fabric8ServiceException e) {
throw e;
} catch (Exception ex) {
throw new Fabric8ServiceException("Unable to build the image using the OpenShift build service", ex);
}
}
use of io.fabric8.arquillian.kubernetes.event.Start in project fabric8 by fabric8io.
the class SuiteListener method start.
public void start(@Observes(precedence = 100) BeforeSuite event, Configuration configuration, Logger logger) {
session = new Session(configuration.getSessionId(), configuration.getNamespace(), logger);
session.init();
sessionProducer.set(session);
controlEvent.fire(new Start(session));
}
use of io.fabric8.arquillian.kubernetes.event.Start in project strimzi by strimzi.
the class TopicSerializationTest method testErrorInConfigInvalidKeyNull.
@Test
public void testErrorInConfigInvalidKeyNull() {
Map<String, String> data = new HashMap<>();
data.put(TopicSerialization.CM_KEY_REPLICAS, "1");
data.put(TopicSerialization.CM_KEY_PARTITIONS, "1");
data.put(TopicSerialization.CM_KEY_CONFIG, "{null:null}");
ConfigMap cm = new ConfigMapBuilder().editOrNewMetadata().withName("my-topic").endMetadata().withData(data).build();
try {
TopicSerialization.fromConfigMap(cm);
fail("Should throw");
} catch (InvalidConfigMapException e) {
assertEquals("ConfigMap's 'data' section has invalid key 'config': " + "Unexpected character ('n' (code 110)): was expecting double-quote to start field name\n" + " at [Source: 'config' key of 'data' section of ConfigMap 'my-topic' in namespace 'null'; line: 1, column: 3]", e.getMessage());
}
}
use of io.fabric8.arquillian.kubernetes.event.Start in project strimzi by strimzi.
the class ClusterControllerTest method startStop.
/**
* Does the CC start and then stop a verticle per namespace?
* @param context
* @param namespaces
*/
private void startStop(TestContext context, String namespaces) {
AtomicInteger numWatchers = new AtomicInteger(0);
KubernetesClient client = mock(KubernetesClient.class);
MixedOperation mockCms = mock(MixedOperation.class);
when(client.configMaps()).thenReturn(mockCms);
List<String> namespaceList = asList(namespaces.split(" *,+ *"));
for (String namespace : namespaceList) {
MixedOperation mockNamespacedCms = mock(MixedOperation.class);
when(mockNamespacedCms.watch(any())).thenAnswer(invo -> {
numWatchers.incrementAndGet();
Watch mockWatch = mock(Watch.class);
doAnswer(invo2 -> {
((Watcher) invo.getArgument(0)).onClose(null);
return null;
}).when(mockWatch).close();
return mockWatch;
});
when(mockNamespacedCms.withLabels(any())).thenReturn(mockNamespacedCms);
when(mockCms.inNamespace(namespace)).thenReturn(mockNamespacedCms);
}
Async async = context.async();
Map<String, String> env = new HashMap<>();
env.put(ClusterControllerConfig.STRIMZI_NAMESPACE, namespaces);
env.put(ClusterControllerConfig.STRIMZI_CONFIGMAP_LABELS, STRIMZI_IO_KIND_CLUSTER);
env.put(ClusterControllerConfig.STRIMZI_FULL_RECONCILIATION_INTERVAL_MS, "120000");
Main.run(vertx, client, true, env).setHandler(ar -> {
context.assertNull(ar.cause(), "Expected all verticles to start OK");
async.complete();
});
async.await();
context.assertEquals(namespaceList.size(), vertx.deploymentIDs().size(), "A verticle per namespace");
List<Async> asyncs = new ArrayList<>();
for (String deploymentId : vertx.deploymentIDs()) {
Async async2 = context.async();
asyncs.add(async2);
vertx.undeploy(deploymentId, ar -> {
context.assertNull(ar.cause(), "Didn't expect error when undeploying verticle " + deploymentId);
async2.complete();
});
}
for (Async async2 : asyncs) {
async2.await();
}
if (numWatchers.get() > namespaceList.size()) {
context.fail("Looks like there were more watchers than namespaces");
}
}
Aggregations