mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
test: remove health check request for e2e flow (#35494)
* remove health check request * add deprecation notice
This commit is contained in:
parent
c45c6655d0
commit
e9a4484daf
@ -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 }
|
||||
);
|
||||
|
@ -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];
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user