AzureMonitor - E2E tests drone update (#57100)

* Update e2e command with video flag

* Add Cloud Plugins E2E tests to drone

* Update env variable names

* Add vault Azure secrets

* Update e2e steps

* Update secrets path

* Update image and rebuild drone file

* Readd drone changes

* Rebuild drone

* Remake drone

* Correct reference to secret

* Remake drone file

* Remove unneeded step

* Clear values in Arg query
This commit is contained in:
Andreas Christou 2022-11-08 10:27:54 +00:00 committed by GitHub
parent e4c394dfcd
commit 5cfd983cc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 124 additions and 3 deletions

View File

@ -507,6 +507,31 @@ steps:
HOST: grafana-server
image: cypress/included:9.5.1-node16.14.0-slim-chrome99-ff97
name: end-to-end-tests-various-suite
- commands:
- cd /
- ./cpp-e2e/scripts/ci-run.sh azure ${DRONE_SOURCE_BRANCH}
depends_on:
- grafana-server
environment:
AZURE_SP_APP_ID:
from_secret: azure_sp_app_id
AZURE_SP_PASSWORD:
from_secret: azure_sp_app_pw
AZURE_TENANT:
from_secret: azure_tenant
CYPRESS_CI: "true"
GITHUB_TOKEN:
from_secret: github_token_pr
HOST: grafana-server
image: us-docker.pkg.dev/grafanalabs-dev/cloud-data-sources/e2e:latest
name: end-to-end-tests-cloud-plugins-suite-azure
when:
paths:
include:
- pkg/tsdb/azuremonitor/**
- public/app/plugins/datasource/grafana-azure-monitor-datasource/**
repo:
- grafana/grafana
- commands:
- apt-get update
- apt-get install -yq zip
@ -1321,6 +1346,31 @@ steps:
HOST: grafana-server
image: cypress/included:9.5.1-node16.14.0-slim-chrome99-ff97
name: end-to-end-tests-various-suite
- commands:
- cd /
- ./cpp-e2e/scripts/ci-run.sh azure ${DRONE_SOURCE_BRANCH}
depends_on:
- grafana-server
environment:
AZURE_SP_APP_ID:
from_secret: azure_sp_app_id
AZURE_SP_PASSWORD:
from_secret: azure_sp_app_pw
AZURE_TENANT:
from_secret: azure_tenant
CYPRESS_CI: "true"
GITHUB_TOKEN:
from_secret: github_token_pr
HOST: grafana-server
image: us-docker.pkg.dev/grafanalabs-dev/cloud-data-sources/e2e:latest
name: end-to-end-tests-cloud-plugins-suite-azure
when:
paths:
include:
- pkg/tsdb/azuremonitor/**
- public/app/plugins/datasource/grafana-azure-monitor-datasource/**
repo:
- grafana/grafana
- commands:
- apt-get update
- apt-get install -yq zip
@ -5409,6 +5459,24 @@ get:
kind: secret
name: gcp_upload_artifacts_key
---
get:
name: application_id
path: infra/data/ci/datasources/cpp-azure-resourcemanager-credentials
kind: secret
name: azure_sp_app_id
---
get:
name: application_secret
path: infra/data/ci/datasources/cpp-azure-resourcemanager-credentials
kind: secret
name: azure_sp_app_pw
---
get:
name: tenant_id
path: infra/data/ci/datasources/cpp-azure-resourcemanager-credentials
kind: secret
name: azure_tenant
---
get:
name: public-key
path: infra/data/ci/packages-publish/gpg
@ -5446,6 +5514,6 @@ kind: secret
name: packages_secret_access_key
---
kind: signature
hmac: 7a173a96edd8b0495105d526b95121599fe2f7fba715bdf2a96073a2af5eca7d
hmac: d703e0a1b27d8396587f430f4175ec924dd51baf4e5b89ff49c94560b9452631
...

View File

@ -183,7 +183,10 @@ e2e.scenario({
queriesForm: () => {
e2eSelectors.queryEditor.header.select().find('input').type('Azure Resource Graph{enter}');
e2e().wait(1000); // Need to wait for code editor to completely load
e2e().get('[aria-label="Remove Primary Subscription"]').click();
e2eSelectors.queryEditor.argsQueryEditor.subscriptions
.input()
.find('[aria-label="select-clear-value"]')
.click();
e2eSelectors.queryEditor.argsQueryEditor.subscriptions.input().find('input').type('datasources{enter}');
e2e.components.CodeEditor.container().type(
"Resources | where resourceGroup == 'cloud-plugins-e2e-test' | project name, resourceGroup"

View File

@ -68,6 +68,7 @@ case "$1" in
*)
cypressConfig[integrationFolder]=../../e2e/"${args[0]}"
cypressConfig[testFiles]=$testFilesForSingleSuite
cypressConfig[video]=${args[1]}
;;
esac

View File

@ -15,6 +15,7 @@ func EndToEndTests(c *cli.Context) error {
tries = c.Int("tries")
suite = c.String("suite")
host = c.String("host")
video = c.String("video")
)
log.Printf("Running Grafana e2e tests")
@ -30,7 +31,7 @@ func EndToEndTests(c *cli.Context) error {
for i := 0; i < tries; i++ {
log.Printf("Running e2e test suite attempt #%d", i+1)
//nolint:gosec
cmd := exec.Command("./e2e/run-suite", suite)
cmd := exec.Command("./e2e/run-suite", suite, video)
cmd.Env = env
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

View File

@ -56,6 +56,11 @@ func main() {
Value: "grafana-server",
Usage: "Specify the server host",
},
&cli.StringFlag{
Name: "video",
Value: "true",
Usage: "Specify if videos should be recorded",
},
},
},
{

View File

@ -36,6 +36,7 @@ load(
'betterer_frontend_step',
'trigger_test_release',
'compile_build_cmd',
'cloud_plugins_e2e_tests_step',
)
load(
@ -75,6 +76,7 @@ def build_e2e(trigger, ver_mode, edition):
e2e_tests_step('smoke-tests-suite', edition=edition),
e2e_tests_step('panels-suite', edition=edition),
e2e_tests_step('various-suite', edition=edition),
cloud_plugins_e2e_tests_step('cloud-plugins-suite', edition=edition, cloud='azure', trigger=trigger_oss),
e2e_tests_artifacts(edition=edition),
build_storybook_step(edition=edition, ver_mode=ver_mode),
copy_packages_for_docker_step(),

View File

@ -731,6 +731,41 @@ def e2e_tests_step(suite, edition, port=3001, tries=None):
],
}
def cloud_plugins_e2e_tests_step(suite, edition, cloud, port=3001, video="false", trigger=None):
environment = {}
when = {}
if trigger:
when = trigger
if cloud == 'azure':
environment = {
'CYPRESS_CI': 'true',
'HOST': 'grafana-server' + enterprise2_suffix(edition),
'GITHUB_TOKEN': from_secret('github_token_pr'),
'AZURE_SP_APP_ID': from_secret('azure_sp_app_id'),
'AZURE_SP_PASSWORD': from_secret('azure_sp_app_pw'),
'AZURE_TENANT': from_secret('azure_tenant')
}
when= dict(when, paths={
'include' : [
'pkg/tsdb/azuremonitor/**',
'public/app/plugins/datasource/grafana-azure-monitor-datasource/**'
]
})
branch = "${DRONE_SOURCE_BRANCH}".replace("/", "-")
step = {
'name': 'end-to-end-tests-{}-{}'.format(suite, cloud) + enterprise2_suffix(edition),
'image': 'us-docker.pkg.dev/grafanalabs-dev/cloud-data-sources/e2e:latest',
'depends_on': [
'grafana-server',
],
'environment': environment,
'commands': [
'cd /',
'./cpp-e2e/scripts/ci-run.sh {} {}'.format(cloud, branch)
],
}
step = dict(step, when=when)
return step
def build_docs_website_step():
return {

View File

@ -3,6 +3,9 @@ github_token = 'github_token'
drone_token = 'drone_token'
prerelease_bucket = 'prerelease_bucket'
gcp_upload_artifacts_key = 'gcp_upload_artifacts_key'
azure_sp_app_id = 'azure_sp_app_id'
azure_sp_app_pw = 'azure_sp_app_pw'
azure_tenant = 'azure_tenant'
def from_secret(secret):
return {
@ -26,6 +29,9 @@ def secrets():
vault_secret(drone_token, 'infra/data/ci/drone', 'machine-user-token'),
vault_secret(prerelease_bucket, 'infra/data/ci/grafana/prerelease', 'bucket'),
vault_secret(gcp_upload_artifacts_key, 'infra/data/ci/grafana/releng/artifacts-uploader-service-account', 'credentials.json'),
vault_secret(azure_sp_app_id, 'infra/data/ci/datasources/cpp-azure-resourcemanager-credentials', 'application_id'),
vault_secret(azure_sp_app_pw, 'infra/data/ci/datasources/cpp-azure-resourcemanager-credentials', 'application_secret'),
vault_secret(azure_tenant, 'infra/data/ci/datasources/cpp-azure-resourcemanager-credentials', 'tenant_id'),
# Package publishing
vault_secret('packages_gpg_public_key', 'infra/data/ci/packages-publish/gpg', 'public-key'),