use of io.hops.hopsworks.alerting.config.dto.SlackConfig in project hopsworks by logicalclocks.
the class TestAlertManagerConfigController method testAddSlackToReceiver.
@Test
public void testAddSlackToReceiver() throws AlertManagerConfigUpdateException, AlertManagerDuplicateEntryException, AlertManagerNoSuchElementException, AlertManagerConfigReadException, AlertManagerResponseException, AlertManagerServerException {
Mockito.when(client.reload()).thenReturn(Response.ok().build());
SlackConfig slackConfig = new SlackConfig("https://hooks.slack.com/services/1234567890/0987654321", "#general").withIconEmoji("https://gravatar.com/avatar/e3fb1c1d58b043af5e3a6a645b7f569f").withTitle("{{ template \"hopsworks.title\" . }}").withText("{{ template \"hopsworks.text\" . }}");
Receiver receiver = new Receiver("slack_general");
AlertManagerConfig config = alertManagerConfigController.addSlackToReceiver("slack_general", slackConfig);
alertManagerConfigController.writeAndReload(config);
AlertManagerConfig alertManagerConfig = this.alertManagerConfigController.read();
int index = alertManagerConfig.getReceivers().indexOf(receiver);
Receiver updatedReceiver = alertManagerConfig.getReceivers().get(index);
assert updatedReceiver.getSlackConfigs().contains(slackConfig);
}
Aggregations