use of io.crate.user.StubUserManager in project crate by crate.
the class PostgresNettyPublishPortTest method testGeneralBindAndPublishAddressOverrideSetting.
@Test
public void testGeneralBindAndPublishAddressOverrideSetting() {
// Check override for network.host
Settings settingsWithCustomHost = Settings.builder().put("network.host", "cantbindtothis").build();
NetworkService networkService = new NetworkService(Collections.emptyList());
StubUserManager userManager = new StubUserManager();
PostgresNetty psql = new PostgresNetty(settingsWithCustomHost, mock(SQLOperations.class), userManager, networkService, new AlwaysOKAuthentication(userManager), new NettyBootstrap(), mock(SslContextProvider.class));
try {
psql.doStart();
fail("Should have failed due to custom hostname");
} catch (BindPostgresException e) {
// that's what we want
assertThat(e.getCause(), instanceOf(UnknownHostException.class));
} finally {
psql.doStop();
psql.close();
}
}
Aggregations