From 7955df4e1476e017845873ccaf1935ef37a8fbb6 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 14 Aug 2023 14:03:18 -0400 Subject: [PATCH] [8.9] [Flaky test #131192] HTTP SSL Redirects (#163726) (#163846) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.9`: - [[Flaky test #131192] HTTP SSL Redirects (#163726)](https://github.com/elastic/kibana/pull/163726) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Alejandro Fernández Haro --- .buildkite/ftr_configs.yml | 2 +- .eslintrc.js | 1 + test/server_integration/http/platform/cache.ts | 2 +- .../http/platform/config.status.ts | 1 - test/server_integration/http/platform/config.ts | 1 - test/server_integration/http/platform/headers.ts | 1 - test/server_integration/http/platform/status.ts | 1 - .../http/ssl_redirect/{config.js => config.ts} | 3 ++- .../http/ssl_redirect/{index.js => index.ts} | 12 ++++++++---- 9 files changed, 13 insertions(+), 11 deletions(-) rename test/server_integration/http/ssl_redirect/{config.js => config.ts} (93%) rename test/server_integration/http/ssl_redirect/{index.js => index.ts} (65%) diff --git a/.buildkite/ftr_configs.yml b/.buildkite/ftr_configs.yml index 1576b7ec24874..64411608f43a1 100644 --- a/.buildkite/ftr_configs.yml +++ b/.buildkite/ftr_configs.yml @@ -152,7 +152,7 @@ enabled: - test/plugin_functional/config.ts - test/server_integration/http/platform/config.status.ts - test/server_integration/http/platform/config.ts - - test/server_integration/http/ssl_redirect/config.js + - test/server_integration/http/ssl_redirect/config.ts - test/server_integration/http/ssl_with_p12_intermediate/config.js - test/server_integration/http/ssl_with_p12/config.js - test/server_integration/http/ssl/config.js diff --git a/.eslintrc.js b/.eslintrc.js index cc4b060312954..f7815436d5609 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -596,6 +596,7 @@ module.exports = { 'test/*/config_open.ts', 'test/*/*.config.ts', 'test/*/{tests,test_suites,apis,apps}/**/*', + 'test/server_integration/**/*.ts', 'x-pack/test/*/{tests,test_suites,apis,apps}/**/*', 'x-pack/test/*/*config.*ts', 'x-pack/test/saved_object_api_integration/*/apis/**/*', diff --git a/test/server_integration/http/platform/cache.ts b/test/server_integration/http/platform/cache.ts index 2c1aa90e963e2..6e1cd8ab39db0 100644 --- a/test/server_integration/http/platform/cache.ts +++ b/test/server_integration/http/platform/cache.ts @@ -7,7 +7,7 @@ */ import { FtrProviderContext } from '../../services/types'; -// eslint-disable-next-line import/no-default-export + export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/test/server_integration/http/platform/config.status.ts b/test/server_integration/http/platform/config.status.ts index 456756aa79262..638d850a8f75c 100644 --- a/test/server_integration/http/platform/config.status.ts +++ b/test/server_integration/http/platform/config.status.ts @@ -17,7 +17,6 @@ import { FtrConfigProviderContext, findTestPluginPaths } from '@kbn/test'; * and installing plugins against built Kibana. This test must be run against source only in order to build the * fixture plugins */ -// eslint-disable-next-line import/no-default-export export default async function ({ readConfigFile }: FtrConfigProviderContext) { const httpConfig = await readConfigFile(require.resolve('../../config.base.js')); diff --git a/test/server_integration/http/platform/config.ts b/test/server_integration/http/platform/config.ts index 028ff67b43022..e78525cb8da60 100644 --- a/test/server_integration/http/platform/config.ts +++ b/test/server_integration/http/platform/config.ts @@ -8,7 +8,6 @@ import { FtrConfigProviderContext } from '@kbn/test'; -// eslint-disable-next-line import/no-default-export export default async function ({ readConfigFile }: FtrConfigProviderContext) { const httpConfig = await readConfigFile(require.resolve('../../config.base.js')); diff --git a/test/server_integration/http/platform/headers.ts b/test/server_integration/http/platform/headers.ts index 309dfbc71b5ff..1a8e9fd610679 100644 --- a/test/server_integration/http/platform/headers.ts +++ b/test/server_integration/http/platform/headers.ts @@ -14,7 +14,6 @@ import { FtrProviderContext } from '../../services/types'; const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const oneSec = 1_000; -// eslint-disable-next-line import/no-default-export export default function ({ getService }: FtrProviderContext) { const config = getService('config'); diff --git a/test/server_integration/http/platform/status.ts b/test/server_integration/http/platform/status.ts index 48006576128ce..50c136bfa1027 100644 --- a/test/server_integration/http/platform/status.ts +++ b/test/server_integration/http/platform/status.ts @@ -12,7 +12,6 @@ import { FtrProviderContext } from '../../services/types'; type ServiceStatusSerialized = Omit & { level: string }; -// eslint-disable-next-line import/no-default-export export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const retry = getService('retry'); diff --git a/test/server_integration/http/ssl_redirect/config.js b/test/server_integration/http/ssl_redirect/config.ts similarity index 93% rename from test/server_integration/http/ssl_redirect/config.js rename to test/server_integration/http/ssl_redirect/config.ts index 47568b16bf6ba..8f8db0e9aae0e 100644 --- a/test/server_integration/http/ssl_redirect/config.js +++ b/test/server_integration/http/ssl_redirect/config.ts @@ -9,10 +9,11 @@ import Url from 'url'; import { readFileSync } from 'fs'; import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; +import { FtrConfigProviderContext } from '@kbn/test'; import { createKibanaSupertestProvider } from '../../services'; -export default async function ({ readConfigFile }) { +export default async function ({ readConfigFile }: FtrConfigProviderContext) { const httpConfig = await readConfigFile(require.resolve('../../config.base.js')); const certificateAuthorities = [readFileSync(CA_CERT_PATH)]; diff --git a/test/server_integration/http/ssl_redirect/index.js b/test/server_integration/http/ssl_redirect/index.ts similarity index 65% rename from test/server_integration/http/ssl_redirect/index.js rename to test/server_integration/http/ssl_redirect/index.ts index 07ae0eb4bb565..6e4e7cfb7decf 100644 --- a/test/server_integration/http/ssl_redirect/index.js +++ b/test/server_integration/http/ssl_redirect/index.ts @@ -6,19 +6,23 @@ * Side Public License, v 1. */ -export default function ({ getService }) { +import { FtrProviderContext } from '../../services/types'; + +export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - // Failing: See https://github.com/elastic/kibana/issues/131192 - // Failing: See https://github.com/elastic/kibana/issues/131192 - describe.skip('kibana server with ssl', () => { + describe('kibana server with ssl', () => { it('redirects http requests at redirect port to https', async () => { const host = process.env.TEST_KIBANA_HOST || 'localhost'; const port = process.env.TEST_KIBANA_PORT || '5620'; const url = `https://${host}:${port}/`; await supertest.get('/').expect('location', url).expect(302); + }); + // Skips because the current version of supertest cannot follow redirects + // Can be unskipped once https://github.com/elastic/kibana/pull/163716 is merged + it.skip('does not boot-loop (2nd redirect points to the landing page)', async () => { await supertest.get('/').redirects(1).expect('location', '/spaces/enter').expect(302); }); });