Closed redcatbear closed 1 year ago
@Test
void testCertificateFailsWithHttpClient() throws KeyManagementException, KeyStoreException,
NoSuchAlgorithmException, CertificateException, IOException, InterruptedException, URISyntaxException {
final SSLContext sslContext = createSslContextWithCertificate();
ExceptionAssertions.assertThrowsWithMessage(IOException.class, () -> sendRequestWithHttpClient(sslContext),
either(equalTo("No subject alternative names present"))
.or(equalTo("No name matching localhost found")));
}
private HttpResponse<String> sendRequestWithHttpClient(final SSLContext sslContext)
throws IOException, InterruptedException, URISyntaxException {
final HttpClient httpClient = HttpClient.newBuilder().sslContext(sslContext).build();
final HttpRequest request = HttpRequest.newBuilder(new URI(CONTAINER.getRpcUrl()))
.POST(BodyPublishers.ofString("")).build();
return httpClient.send(request, BodyHandlers.ofString());
}
This test tries to connect to the container's RPC port and expects a failure. I think it should verify that the RPC port is open.
After discussing with @kaklakariada, we agreed that this test exercises a feature of the docker-db
, not of the exasol-testcontainer
and thus does not belong here.
Situation
We had the following test failing with 8.17.0:
I read the test a couple of times, but did not understand, what it was supposed to prove. It looked like it exercised a client instead of the Exasol Test Container (which should be the unit under test).
@kaklakariada, when you are back, maybe you can shed some light on this.