From fb397459717c0d71388bb022369c4a747810fc4f Mon Sep 17 00:00:00 2001 From: Pratik Agarwal Date: Tue, 31 Oct 2023 14:13:58 -0300 Subject: [PATCH 1/4] chore: relax auth test expiration window for CIs under high contention --- packages/client-sdk-nodejs/package.json | 2 +- packages/common-integration-tests/src/auth-client.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/client-sdk-nodejs/package.json b/packages/client-sdk-nodejs/package.json index 596ab87c9..354e4bddf 100644 --- a/packages/client-sdk-nodejs/package.json +++ b/packages/client-sdk-nodejs/package.json @@ -15,7 +15,7 @@ "scripts": { "prebuild": "eslint . --ext .ts", "test": "jest --testPathIgnorePatterns auth-client.test.ts --reporters=jest-silent-reporter", - "integration-test-auth": "jest auth-client.test.ts --reporters=jest-silent-reporter", + "integration-test-auth": "jest auth-client.test.ts", "integration-test-vector": "jest vector-control-plane.test.ts vector-data-plane.test.ts --reporters=jest-silent-reporter", "unit-test": "jest unit --reporters=jest-silent-reporter", "integration-test": "jest integration --reporters=jest-silent-reporter --testPathIgnorePatterns \"auth-client.test.ts|vector-control-plane.test.ts|vector-data-plane.test.ts\"", diff --git a/packages/common-integration-tests/src/auth-client.ts b/packages/common-integration-tests/src/auth-client.ts index b09541d6e..f62ef485c 100644 --- a/packages/common-integration-tests/src/auth-client.ts +++ b/packages/common-integration-tests/src/auth-client.ts @@ -69,18 +69,20 @@ export function runAuthClientTests( const secondsSinceEpoch = Math.round(Date.now() / 1000); const expireResponse = await sessionTokenAuthClient.generateApiKey( SUPER_USER_PERMISSIONS, - ExpiresIn.seconds(10) + ExpiresIn.minutes(5) ); - const expiresIn = secondsSinceEpoch + 10; - expect(expireResponse).toBeInstanceOf(GenerateApiKey.Success); + const expiresIn = secondsSinceEpoch + 300; + expect(expireResponse).toBeInstanceOf(GenerateApiKey.Success); const expireResponseSuccess = expireResponse as GenerateApiKey.Success; expect(expireResponseSuccess.is_success); + console.log(expiresIn); + console.log(expireResponseSuccess.expiresAt.epoch()); expect(expireResponseSuccess.expiresAt.doesExpire()); expect(expireResponseSuccess.expiresAt.epoch()).toBeWithin( - expiresIn - 1, - expiresIn + 2 + expiresIn - 60, + expiresIn + 60 ); }); From 2f972ecc439233cbb8922ee836743db5b6961244 Mon Sep 17 00:00:00 2001 From: Pratik Agarwal Date: Tue, 31 Oct 2023 14:14:37 -0300 Subject: [PATCH 2/4] chore: add back jest silent reporter to auth tests --- packages/client-sdk-nodejs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client-sdk-nodejs/package.json b/packages/client-sdk-nodejs/package.json index 354e4bddf..596ab87c9 100644 --- a/packages/client-sdk-nodejs/package.json +++ b/packages/client-sdk-nodejs/package.json @@ -15,7 +15,7 @@ "scripts": { "prebuild": "eslint . --ext .ts", "test": "jest --testPathIgnorePatterns auth-client.test.ts --reporters=jest-silent-reporter", - "integration-test-auth": "jest auth-client.test.ts", + "integration-test-auth": "jest auth-client.test.ts --reporters=jest-silent-reporter", "integration-test-vector": "jest vector-control-plane.test.ts vector-data-plane.test.ts --reporters=jest-silent-reporter", "unit-test": "jest unit --reporters=jest-silent-reporter", "integration-test": "jest integration --reporters=jest-silent-reporter --testPathIgnorePatterns \"auth-client.test.ts|vector-control-plane.test.ts|vector-data-plane.test.ts\"", From f89f1a18c3e91a8ca3ebdf73313f7357bb4a7062 Mon Sep 17 00:00:00 2001 From: Pratik Agarwal Date: Tue, 31 Oct 2023 14:19:09 -0300 Subject: [PATCH 3/4] Remove console log statements --- packages/common-integration-tests/src/auth-client.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/common-integration-tests/src/auth-client.ts b/packages/common-integration-tests/src/auth-client.ts index f62ef485c..e64414c72 100644 --- a/packages/common-integration-tests/src/auth-client.ts +++ b/packages/common-integration-tests/src/auth-client.ts @@ -77,8 +77,6 @@ export function runAuthClientTests( expect(expireResponse).toBeInstanceOf(GenerateApiKey.Success); const expireResponseSuccess = expireResponse as GenerateApiKey.Success; expect(expireResponseSuccess.is_success); - console.log(expiresIn); - console.log(expireResponseSuccess.expiresAt.epoch()); expect(expireResponseSuccess.expiresAt.doesExpire()); expect(expireResponseSuccess.expiresAt.epoch()).toBeWithin( expiresIn - 60, From abbdbe4ce47f3cb4af5fc7f7bb98f14ca5b68307 Mon Sep 17 00:00:00 2001 From: Pratik Agarwal Date: Tue, 31 Oct 2023 14:33:30 -0300 Subject: [PATCH 4/4] chore: increase deadline to 60 seconds --- .../client-sdk-nodejs/test/integration/integration-setup.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client-sdk-nodejs/test/integration/integration-setup.ts b/packages/client-sdk-nodejs/test/integration/integration-setup.ts index 478871f3e..a6cfb8ba4 100644 --- a/packages/client-sdk-nodejs/test/integration/integration-setup.ts +++ b/packages/client-sdk-nodejs/test/integration/integration-setup.ts @@ -75,7 +75,8 @@ function sessionCredsProvider(): CredentialProvider { export function integrationTestCacheClientProps(): CacheClientProps { return { - configuration: Configurations.Laptop.latest(), + configuration: + Configurations.Laptop.latest().withClientTimeoutMillis(60000), credentialProvider: credsProvider(), defaultTtlSeconds: 1111, };