From e9a4484dafd3776781915d026208c7aae799cd5b Mon Sep 17 00:00:00 2001 From: Vicky Lee <36230812+vickyyyyyyy@users.noreply.github.com> Date: Thu, 10 Jun 2021 16:11:10 +0100 Subject: [PATCH] test: remove health check request for e2e flow (#35494) * remove health check request * add deprecation notice --- .../grafana-e2e/src/flows/addDataSource.ts | 18 +++++------------- packages/grafana-e2e/src/support/url.ts | 9 --------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/packages/grafana-e2e/src/flows/addDataSource.ts b/packages/grafana-e2e/src/flows/addDataSource.ts index 5b15464cffc..2522cf16c9a 100644 --- a/packages/grafana-e2e/src/flows/addDataSource.ts +++ b/packages/grafana-e2e/src/flows/addDataSource.ts @@ -1,12 +1,14 @@ import { DeleteDataSourceConfig } from './deleteDataSource'; import { e2e } from '../index'; -import { fromBaseUrl, getDataSourceId } from '../support/url'; import { v4 as uuidv4 } from 'uuid'; export interface AddDataSourceConfig { basicAuth: boolean; basicAuthPassword: string; basicAuthUser: string; + /** + * @deprecated check health request is no longer supported + */ checkHealth: boolean; expectedAlertMessage: string | RegExp; form: () => void; @@ -35,7 +37,6 @@ export const addDataSource = (config?: Partial) => { basicAuth, basicAuthPassword, basicAuthUser, - checkHealth, expectedAlertMessage, form, name, @@ -88,26 +89,17 @@ export const addDataSource = (config?: Partial) => { return e2e() .url() - .then((url: string) => { - const id = getDataSourceId(url); - + .then(() => { e2e.getScenarioContext().then(({ addedDataSources }: any) => { e2e.setScenarioContext({ - addedDataSources: [...addedDataSources, { id, name } as DeleteDataSourceConfig], + addedDataSources: [...addedDataSources, { name } as DeleteDataSourceConfig], }); }); - if (checkHealth) { - const healthUrl = fromBaseUrl(`/api/datasources/${id}/health`); - e2e().logToConsole(`Fetching ${healthUrl}`); - e2e().request(healthUrl).its('body').should('have.property', 'status').and('eq', 'OK'); - } - // @todo remove `wrap` when possible return e2e().wrap( { config: fullConfig, - id, }, { log: false } ); diff --git a/packages/grafana-e2e/src/support/url.ts b/packages/grafana-e2e/src/support/url.ts index 9d579d75076..7af06d000ac 100644 --- a/packages/grafana-e2e/src/support/url.ts +++ b/packages/grafana-e2e/src/support/url.ts @@ -12,12 +12,3 @@ export const getDashboardUid = (url: string): string => { return matches[1]; } }; - -export const getDataSourceId = (url: string): string => { - const matches = new URL(url).pathname.match(/\/edit\/([^/]+)/); - if (!matches) { - throw new Error(`Couldn't parse id from ${url}`); - } else { - return matches[1]; - } -};