From 91f66d61e1a5bbc97d79e91f1e7c012dd0561945 Mon Sep 17 00:00:00 2001 From: Andreas Christou Date: Wed, 12 Apr 2023 13:13:33 +0100 Subject: [PATCH] Make health check optional --- e2e/cloud-plugins-suite/azure-monitor.spec.ts | 1 + packages/grafana-e2e/src/flows/addDataSource.ts | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/e2e/cloud-plugins-suite/azure-monitor.spec.ts b/e2e/cloud-plugins-suite/azure-monitor.spec.ts index 37ced38c1d3..9f79a5fd5c8 100644 --- a/e2e/cloud-plugins-suite/azure-monitor.spec.ts +++ b/e2e/cloud-plugins-suite/azure-monitor.spec.ts @@ -50,6 +50,7 @@ function provisionAzureMonitorDatasources(datasources: AzureMonitorProvision[]) expectedAlertMessage: 'Successfully connected to all Azure Monitor endpoints', // Reduce the timeout from 30s to error faster when an invalid alert message is presented timeout: 10000, + awaitHealth: true, }); } diff --git a/packages/grafana-e2e/src/flows/addDataSource.ts b/packages/grafana-e2e/src/flows/addDataSource.ts index 10bce8ee5c9..38779572bd4 100644 --- a/packages/grafana-e2e/src/flows/addDataSource.ts +++ b/packages/grafana-e2e/src/flows/addDataSource.ts @@ -14,6 +14,7 @@ export interface AddDataSourceConfig { skipTlsVerify: boolean; type: string; timeout?: number; + awaitHealth?: boolean; } // @todo this actually returns type `Cypress.Chainable` @@ -40,11 +41,14 @@ export const addDataSource = (config?: Partial) => { skipTlsVerify, type, timeout, + awaitHealth, } = fullConfig; - e2e() - .intercept(/health/) - .as('health'); + if (awaitHealth) { + e2e() + .intercept(/health/) + .as('health'); + } e2e().logToConsole('Adding data source with name:', name); e2e.pages.AddDataSource.visit(); @@ -80,7 +84,9 @@ export const addDataSource = (config?: Partial) => { e2e.pages.DataSource.saveAndTest().click(); - e2e().wait('@health', { timeout: timeout ?? e2e.config().defaultCommandTimeout }); + if (awaitHealth) { + e2e().wait('@health', { timeout: timeout ?? e2e.config().defaultCommandTimeout }); + } // use the timeout passed in if it exists, otherwise, continue to use the default e2e.pages.DataSource.alert()