Skip to content

Commit 466022e

Browse files
committed
fixing JWT tests
1 parent cc22178 commit 466022e

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ jobs:
278278
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT_PROD }}
279279
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT_PROD }}
280280
CLIENT_JWT: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_DESERT_VM_43 }}
281+
JWT_TEST_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
281282
run: |
282283
mvn --batch-mode --no-transfer-progress --projects ${{ matrix.project }} -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=http -Dmaven.javadoc.skip=true verify
283284
- name: Upload test results

client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,10 +1218,17 @@ public void testJWTWithCloud() throws Exception {
12181218
if (!isCloud()) {
12191219
return; // only for cloud
12201220
}
1221-
String jwt = System.getenv("CLIENT_JWT");
1221+
final String jwt = System.getenv("CLIENT_JWT");
1222+
final String host = System.getenv("JWT_TEST_HOST");
12221223
Assert.assertTrue(jwt != null && !jwt.trim().isEmpty(), "JWT is missing");
12231224
Assert.assertFalse(jwt.contains("\n") || jwt.contains("-----"), "JWT should be single string ready for HTTP header");
1224-
try (Client client = newClient().useBearerTokenAuth(jwt).build()) {
1225+
try (Client client = new Client.Builder()
1226+
.addEndpoint(Protocol.HTTP, host, 8443, true)
1227+
.setUsername("default")
1228+
.compressClientRequest(false)
1229+
.setDefaultDatabase("default")
1230+
.serverSetting(ServerSettings.WAIT_END_OF_QUERY, "1")
1231+
.useBearerTokenAuth(jwt).build()) {
12251232
try {
12261233
List<GenericRecord> response = client.queryAll("SELECT user(), now()");
12271234
System.out.println("response: " + response.get(0).getString(1) + " time: " + response.get(0).getString(2));

0 commit comments

Comments
 (0)