From 1f1eb8adc2c541eb60d94ec0ccdd8c004884f119 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Mon, 14 Aug 2023 15:23:40 -0400 Subject: [PATCH 1/4] Explicitly pass basePath: false in jwt_auth.test.ts Signed-off-by: Craig Perkins --- test/jest_integration/jwt_auth.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/jest_integration/jwt_auth.test.ts b/test/jest_integration/jwt_auth.test.ts index 12c6d3ccc..6ffe26aa5 100644 --- a/test/jest_integration/jwt_auth.test.ts +++ b/test/jest_integration/jwt_auth.test.ts @@ -35,7 +35,7 @@ describe('start OpenSearch Dashboards server', () => { const pageTitleXPath = '//*[@id="osdOverviewPageHeader__title"]'; // Browser Settings const browser = 'firefox'; - const options = new Options().headless(); + const options = new Options(); const rawKey = 'This is a very secure secret. No one will ever be able to guess it!'; const b = Buffer.from(rawKey); const signingKey = b.toString('base64'); @@ -76,6 +76,7 @@ describe('start OpenSearch Dashboards server', () => { // to make ignoreVersionMismatch setting work // can be removed when we have corresponding ES version dev: true, + basePath: false } ); @@ -118,6 +119,7 @@ describe('start OpenSearch Dashboards server', () => { } ); const responseBody = (getConfigResponse.payload as Buffer).toString(); + console.log("responseBody: " + responseBody); config = JSON.parse(responseBody).config; const jwtConfig = { http_enabled: true, @@ -143,16 +145,19 @@ describe('start OpenSearch Dashboards server', () => { config.dynamic!.authc!.jwt_auth_domain = jwtConfig; config.dynamic!.authc!.basic_internal_auth_domain.http_authenticator.challenge = false; config.dynamic!.http!.anonymous_auth_enabled = false; + console.log("config: " + JSON.stringify(config, null, 2)); await wreck.put('https://localhost:9200/_plugins/_security/api/securityconfig/config', { payload: config, rejectUnauthorized: false, headers: { 'Content-Type': 'application/json', - authorization: ADMIN_CREDENTIALS, + 'Authorization': ADMIN_CREDENTIALS, }, }); } catch (error) { console.log('Got an error while updating security config!!', error.stack); + console.log(error); + console.log(error.message) fail(error); } }); From 1cd1f88335991f32c37f342ec04d31c41fed7aa3 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Mon, 14 Aug 2023 15:25:57 -0400 Subject: [PATCH 2/4] Headless Signed-off-by: Craig Perkins --- test/jest_integration/jwt_auth.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jest_integration/jwt_auth.test.ts b/test/jest_integration/jwt_auth.test.ts index 6ffe26aa5..c1e4602b8 100644 --- a/test/jest_integration/jwt_auth.test.ts +++ b/test/jest_integration/jwt_auth.test.ts @@ -35,7 +35,7 @@ describe('start OpenSearch Dashboards server', () => { const pageTitleXPath = '//*[@id="osdOverviewPageHeader__title"]'; // Browser Settings const browser = 'firefox'; - const options = new Options(); + const options = new Options().headless(); const rawKey = 'This is a very secure secret. No one will ever be able to guess it!'; const b = Buffer.from(rawKey); const signingKey = b.toString('base64'); From 3ed3fafb0475c2e9f441a54939d799e125a189fb Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Mon, 14 Aug 2023 15:33:41 -0400 Subject: [PATCH 3/4] Remove console logs Signed-off-by: Craig Perkins --- test/jest_integration/jwt_auth.test.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/jest_integration/jwt_auth.test.ts b/test/jest_integration/jwt_auth.test.ts index c1e4602b8..ae42bd2ce 100644 --- a/test/jest_integration/jwt_auth.test.ts +++ b/test/jest_integration/jwt_auth.test.ts @@ -119,7 +119,6 @@ describe('start OpenSearch Dashboards server', () => { } ); const responseBody = (getConfigResponse.payload as Buffer).toString(); - console.log("responseBody: " + responseBody); config = JSON.parse(responseBody).config; const jwtConfig = { http_enabled: true, @@ -145,19 +144,16 @@ describe('start OpenSearch Dashboards server', () => { config.dynamic!.authc!.jwt_auth_domain = jwtConfig; config.dynamic!.authc!.basic_internal_auth_domain.http_authenticator.challenge = false; config.dynamic!.http!.anonymous_auth_enabled = false; - console.log("config: " + JSON.stringify(config, null, 2)); await wreck.put('https://localhost:9200/_plugins/_security/api/securityconfig/config', { payload: config, rejectUnauthorized: false, headers: { 'Content-Type': 'application/json', - 'Authorization': ADMIN_CREDENTIALS, + authorization: ADMIN_CREDENTIALS, }, }); } catch (error) { console.log('Got an error while updating security config!!', error.stack); - console.log(error); - console.log(error.message) fail(error); } }); From 1518899357bcccfcf18f553e9b07e47e548f002b Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Mon, 14 Aug 2023 16:12:07 -0400 Subject: [PATCH 4/4] Add comma Signed-off-by: Craig Perkins --- test/jest_integration/jwt_auth.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jest_integration/jwt_auth.test.ts b/test/jest_integration/jwt_auth.test.ts index ae42bd2ce..8d2271df9 100644 --- a/test/jest_integration/jwt_auth.test.ts +++ b/test/jest_integration/jwt_auth.test.ts @@ -76,7 +76,7 @@ describe('start OpenSearch Dashboards server', () => { // to make ignoreVersionMismatch setting work // can be removed when we have corresponding ES version dev: true, - basePath: false + basePath: false, } );