Skip to content

Commit fa53726

Browse files
authored
Merge pull request #2085 from ClickHouse/repo_fix_jwt_tests
[repo] Fix JWT tests
2 parents 5995a7e + 88fbe0d commit fa53726

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,17 @@ jobs:
247247
EOF
248248
- name: Install Java client
249249
run: mvn --also-make --batch-mode --no-transfer-progress -DskipTests install
250-
- name: Generate JWT
251-
env:
252-
JWT_K_PEM: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_PRIVATE_KEY }}
253-
run: |
254-
npm install jsonwebtoken &&
255-
echo "CLIENT_JWT=$(node jwt-gen.js)" >> "$GITHUB_ENV"
250+
# - name: Generate JWT
251+
# env:
252+
# JWT_K_PEM: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_PRIVATE_KEY }}
253+
# run: |
254+
# npm install jsonwebtoken &&
255+
# echo "CLIENT_JWT=$(node jwt-gen.js)" >> "$GITHUB_ENV"
256256
- name: Test http client
257257
env:
258258
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
259259
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
260+
CLIENT_JWT: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_DESERT_VM_43 }}
260261
run: |
261262
mvn --batch-mode --no-transfer-progress --projects ${{ matrix.project }} -DclickhouseVersion=${{ matrix.clickhouse }} -Dprotocol=http verify
262263
- name: Upload test results

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED;
6262
import static org.junit.Assert.assertEquals;
63+
import static org.junit.Assert.assertNotNull;
6364
import static org.junit.Assert.assertThrows;
6465
import static org.junit.Assert.fail;
6566

@@ -1016,6 +1017,8 @@ public void testJWTWithCloud() throws Exception {
10161017
return; // only for cloud
10171018
}
10181019
String jwt = System.getenv("CLIENT_JWT");
1020+
Assert.assertTrue(jwt != null && !jwt.trim().isEmpty(), "JWT is missing");
1021+
Assert.assertFalse(jwt.contains("\n") || jwt.contains("-----"), "JWT should be single string ready for HTTP header");
10191022
try (Client client = newClient().useBearerTokenAuth(jwt).build()) {
10201023
try {
10211024
List<GenericRecord> response = client.queryAll("SELECT user(), now()");

0 commit comments

Comments
 (0)