Skip to content

Added test for sslMode=prefer #43 #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,53 @@ public void testNoSslConfiguration(TestContext context) {
});
}


@Test
public void testPreferSslConfiguration(TestContext context) {
Async async = context.async();
SQLClient clientSsl = createClient(vertx,
new JsonObject()
.put("host", System.getProperty("db.host", "localhost"))
.put("port", Integer.parseInt(System.getProperty("dbssl.port", "54321")))
.put("sslMode", "prefer")
);
SQLClient clientNoSsl = createClient(vertx,
new JsonObject()
.put("host", System.getProperty("db.host", "localhost"))
.put("port", Integer.parseInt(System.getProperty("dbssl.port", "54321")))
.put("sslMode", "prefer")
);

System.out.println("testPreferSslConfiguration");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of these debug messages I think


clientSsl.getConnection(sqlConnectionAsyncResult -> {
context.assertTrue(sqlConnectionAsyncResult.succeeded());
conn = sqlConnectionAsyncResult.result();
System.out.println("testPreferSslConfiguration step2");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of these debug messages I think

conn.query("SELECT 1", ar -> {
System.out.println("testPreferSslConfiguration callback2");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of these debug messages I think

if (ar.failed()) {
context.fail("Should not fail on ssl connection");
} else {
System.out.println("testPreferSslConfiguration SSL OK");

clientNoSsl.getConnection(sqlConnectionAsyncResult2 -> {
context.assertTrue(sqlConnectionAsyncResult2.succeeded());
conn = sqlConnectionAsyncResult2.result();
System.out.println("testPreferSslConfiguration step3");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of these debug messages I think

conn.query("SELECT 1", ar2 -> {
System.out.println("testPreferSslConfiguration callback4");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of these debug messages I think

if (ar2.failed()) {
context.fail("Should not fail on non-ssl connection");
} else {
System.out.println("testPreferSslConfiguration non-SSL OK");
System.out.println("testPreferSslConfiguration all good!");
async.complete();
}
});
});
}
});
});
}
}