test: remove health check request for e2e flow (#35494)

* remove health check request

* add deprecation notice
This commit is contained in:
Vicky Lee 2021-06-10 16:11:10 +01:00 committed by GitHub
parent c45c6655d0
commit e9a4484daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 22 deletions

View File

@ -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<AddDataSourceConfig>) => {
basicAuth,
basicAuthPassword,
basicAuthUser,
checkHealth,
expectedAlertMessage,
form,
name,
@ -88,26 +89,17 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
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 }
);

View File

@ -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];
}
};