use of io.strimzi.test.Namespace in project strimzi by strimzi.
the class ControllerIT method waitForEvent.
private void waitForEvent(TestContext context, ConfigMap cm, String expectedMessage, Controller.EventType expectedType) {
waitFor(context, () -> {
List<Event> items = kubeClient.events().inNamespace(NAMESPACE).withLabels(cmPredicate.labels()).list().getItems();
List<Event> filtered = items.stream().filter(evt -> !preExistingEvents.contains(evt.getMetadata().getUid()) && "ConfigMap".equals(evt.getInvolvedObject().getKind()) && cm.getMetadata().getName().equals(evt.getInvolvedObject().getName())).collect(Collectors.toList());
LOGGER.debug("Waiting for events: {}", filtered.stream().map(evt -> evt.getMessage()).collect(Collectors.toList()));
if (!filtered.isEmpty()) {
assertEquals(1, filtered.size());
Event event = filtered.get(0);
assertEquals(expectedMessage, event.getMessage());
assertEquals(expectedType.name, event.getType());
assertNotNull(event.getInvolvedObject());
assertEquals("ConfigMap", event.getInvolvedObject().getKind());
assertEquals(cm.getMetadata().getName(), event.getInvolvedObject().getName());
return true;
} else {
return false;
}
}, timeout, "Expected an error event");
}
Aggregations