[bitnami/thanos] Add Thanos Helm Chart tests (#9635)

* Added the Thanos folder structure and some really basic tests

Signed-off-by: alukic <alukic@vmware.com>

* Added more functional tests which also check for existing store

Signed-off-by: alukic <alukic@vmware.com>

* Added the workflow for Thanos

Signed-off-by: alukic <alukic@vmware.com>

* Tweaked the workflow

Signed-off-by: alukic <alukic@vmware.com>

* Added the final version of the tests

Signed-off-by: alukic <alukic@vmware.com>

* Remove previous version of the workflow

Signed-off-by: alukic <alukic@vmware.com>

* Removed phpmyadmin folder

Signed-off-by: alukic <alukic@vmware.com>

* Formatting the cypress.json file

Signed-off-by: alukic <alukic@vmware.com>

* Formatted the cypress.json

Signed-off-by: alukic <alukic@vmware.com>

* Remove unnecessary environment variables

Signed-off-by: alukic <alukic@vmware.com>

* Removed extra shoulds

Signed-off-by: alukic <alukic@vmware.com>

* New line

Signed-off-by: alukic <alukic@vmware.com>

* New line removal

Signed-off-by: alukic <alukic@vmware.com>

* Renamed the variable name, removed dark/light mode test

Signed-off-by: alukic <alukic@vmware.com>

* Data query

Signed-off-by: alukic <alukic@vmware.com>

* Improved query execution test

Signed-off-by: alukic <alukic@vmware.com>

* Improved assertions

Signed-off-by: alukic <alukic@vmware.com>

* Removed extra assertions

Signed-off-by: alukic <alukic@vmware.com>

* Removed extra assertion

Signed-off-by: alukic <alukic@vmware.com>

* Chaining selectors

Signed-off-by: alukic <alukic@vmware.com>

* Removed chaning UI tests

Signed-off-by: alukic <alukic@vmware.com>

* Applied code review suggestions

Signed-off-by: alukic <alukic@vmware.com>

* Version information was missing

Signed-off-by: alukic <alukic@vmware.com>

* A typo

Signed-off-by: alukic <alukic@vmware.com>

* Implemented the suggestion related to the badge

Signed-off-by: alukic <alukic@vmware.com>

* Applied code review suggestions

Signed-off-by: alukic <alukic@vmware.com>

* Formatting, added more asserts

Signed-off-by: alukic <alukic@vmware.com>

* Removed other extra asserts

Signed-off-by: alukic <alukic@vmware.com>

* Changing the store endpoint assertion

Signed-off-by: alukic <alukic@vmware.com>

* Removed extra be.visible assertion

Signed-off-by: alukic <alukic@vmware.com>

* Formatting

Signed-off-by: alukic <alukic@vmware.com>

* Undo unwanted formatting

Signed-off-by: alukic <alukic@vmware.com>

* Formatting

Signed-off-by: alukic <alukic@vmware.com>

* Change the name of the environment variable

Signed-off-by: alukic <alukic@vmware.com>

* Increase click delay to prevent flakiness

Signed-off-by: alukic <alukic@vmware.com>

* Changed the variable name to match the new one

Signed-off-by: alukic <alukic@vmware.com>

* Added type delay to fix flakiness

Signed-off-by: alukic <alukic@vmware.com>

* Adding back the ;

Signed-off-by: alukic <alukic@vmware.com>

* Format consistency

Signed-off-by: alukic <alukic@vmware.com>

* Formatting

Signed-off-by: alukic <alukic@vmware.com>

* Last formatting after plugin config

Signed-off-by: alukic <alukic@vmware.com>
This commit is contained in:
superaleks
2022-04-07 13:12:38 +02:00
committed by GitHub
parent 789a0f6e51
commit 056b262ffc
12 changed files with 322 additions and 0 deletions
@@ -0,0 +1,36 @@
name: 'vib'
on: # rebuild any PRs and main branch changes
pull_request_target:
branches:
- master
paths:
- 'bitnami/thanos/*'
env:
CSP_API_URL: https://console.cloud.vmware.com
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
VIB_PUBLIC_URL: https://cp.bromelia.vmware.com
jobs:
vib-k8s-verify: # verify in multiple target platforms
runs-on: ubuntu-latest
environment: vmware-image-builder
strategy:
matrix:
include:
- target-platform: gke
target-platform-id: 91d398a2-25c4-4cda-8732-75a3cfc179a1
- target-platform: aks
target-platform-id: 7b13a7bb-011c-474f-ad71-8152fc321b9e
- target-platform: tkg
target-platform-id: 7ddab896-2e4e-4d58-a501-f79897eba3a0
fail-fast: false
name: K8s verify ${{ matrix.target-platform}}
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: vmware-labs/vmware-image-builder-action@main
with:
pipeline: thanos/bucketweb/vib-platform-verify.json
env:
VIB_ENV_TARGET_PLATFORM: ${{ matrix.target-platform-id }}
@@ -0,0 +1,36 @@
name: 'vib'
on: # rebuild any PRs and main branch changes
pull_request_target:
branches:
- master
paths:
- 'bitnami/thanos/*'
env:
CSP_API_URL: https://console.cloud.vmware.com
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
VIB_PUBLIC_URL: https://cp.bromelia.vmware.com
jobs:
vib-k8s-verify: # verify in multiple target platforms
runs-on: ubuntu-latest
environment: vmware-image-builder
strategy:
matrix:
include:
- target-platform: gke
target-platform-id: 91d398a2-25c4-4cda-8732-75a3cfc179a1
- target-platform: aks
target-platform-id: 7b13a7bb-011c-474f-ad71-8152fc321b9e
- target-platform: tkg
target-platform-id: 7ddab896-2e4e-4d58-a501-f79897eba3a0
fail-fast: false
name: K8s verify ${{ matrix.target-platform}}
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: vmware-labs/vmware-image-builder-action@main
with:
pipeline: thanos/queryfrontend/vib-platform-verify.json
env:
VIB_ENV_TARGET_PLATFORM: ${{ matrix.target-platform-id }}
@@ -0,0 +1,4 @@
{
"baseUrl": "http://localhost",
"defaultCommandTimeout": 40000
}
@@ -0,0 +1,19 @@
/// <reference types="cypress" />
it('allows to see runtime & build information', () => {
cy.visit('/');
cy.contains('.dropdown-toggle', 'Status').click();
cy.contains('[class="dropdown-item"]', 'Runtime & Build Information').click();
cy.contains('Runtime Information');
cy.get('h2').contains('Build Information');
cy.contains('.capitalize-title', 'version').siblings().should('not.be.empty'); //check if there is value for app and Go Version
cy.contains('.capitalize-title', 'goVersion')
.siblings()
.should('not.be.empty');
});
it('allows to see the Blocks page', () => {
cy.visit('/');
cy.get('.nav-link').contains('Blocks').click();
cy.contains('No blocks found.');
});
@@ -0,0 +1,13 @@
const COMMAND_DELAY = 1300;
for (const command of ['click']) {
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
const origVal = originalFn(...args);
return new Promise((resolve) => {
setTimeout(() => {
resolve(origVal);
}, COMMAND_DELAY);
});
});
}
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
@@ -0,0 +1,51 @@
{
"phases": {
"package": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/thanos"
}
},
"actions": [
{
"action_id": "helm-package"
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/thanos"
},
"runtime_parameters": "b2Jqc3RvcmVDb25maWc6IHwtCiAgdHlwZTogRklMRVNZU1RFTQogIGNvbmZpZzoKICAgIGRpcmVjdG9yeTogIi8iCgpidWNrZXR3ZWI6CiAgZW5hYmxlZDogdHJ1ZQogIHNlcnZpY2U6CiAgICB0eXBlOiBMb2FkQmFsYW5jZXIKICAgIHBvcnRzOgogICAgICBodHRwOiA4MA==",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "M4"
}
}
},
"actions": [
{
"action_id": "health-check",
"params": {
"endpoint": "lb-thanos-bucketweb-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/thanos/bucketweb/cypress"
},
"endpoint": "lb-thanos-bucketweb-http",
"app_protocol": "HTTP"
}
}
]
}
}
}
@@ -0,0 +1,4 @@
{
"baseUrl": "http://localhost/",
"defaultCommandTimeout": 40000
}
@@ -0,0 +1,42 @@
/// <reference types="cypress" />
it('allows to see runtime & build information', () => {
cy.visit('/');
cy.contains('.dropdown-toggle', 'Status').click();
cy.contains('[class="dropdown-item"]', 'Runtime & Build Information').click();
cy.contains('Runtime Information');
cy.contains('h2', 'Build Information');
cy.contains('.capitalize-title', 'version').siblings().should('not.be.empty'); //check if there is value for app and Go Version
cy.contains('.capitalize-title', 'goVersion')
.siblings()
.should('not.be.empty');
});
it('allows the execution of a query', () => {
const QUERY_ALERT = 'No data queried yet';
const QUERY_KEYWORD = 'vector';
const QUERY_VALUE = '3000';
cy.visit('/graph');
cy.contains('.alert', QUERY_ALERT);
cy.get('.cm-line')
.type(QUERY_KEYWORD, '{enter}')
.type(`(${QUERY_VALUE})`)
.click();
cy.get('.execute-btn').click();
cy.contains('.tab-content', QUERY_VALUE);
});
it('allows listing all installed stores', () => {
cy.visit('/');
cy.contains('[class="nav-link"]', 'Stores').click();
cy.get('[data-testid="endpoint"]').should('not.be.empty');
cy.get('[data-testid="health"]').contains('UP');
});
it('allows adding a graph', () => {
cy.visit('/');
cy.contains('button', 'Add Panel').click();
cy.get('.execute-btn').should('have.length', 2);
});
@@ -0,0 +1,26 @@
const CLICK_DELAY = 1300;
const TYPE_DELAY = 300;
for (const command of ['click']) {
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
const origVal = originalFn(...args);
return new Promise((resolve) => {
setTimeout(() => {
resolve(origVal);
}, CLICK_DELAY);
});
});
}
for (const command of ['type']) {
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
const origVal = originalFn(...args);
return new Promise((resolve) => {
setTimeout(() => {
resolve(origVal);
}, TYPE_DELAY);
});
});
}
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';
// Alternatively you can use CommonJS syntax:
// require('./commands')
@@ -0,0 +1,51 @@
{
"phases": {
"package": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/thanos"
}
},
"actions": [
{
"action_id": "helm-package"
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/thanos"
},
"runtime_parameters": "b2Jqc3RvcmVDb25maWc6IHwtCiAgdHlwZTogRklMRVNZU1RFTQogIGNvbmZpZzoKICAgIGRpcmVjdG9yeTogIi8iCgpxdWVyeUZyb250ZW5kOgogIGVuYWJsZWQ6IHRydWUKICBzZXJ2aWNlOgogICAgdHlwZTogTG9hZEJhbGFuY2VyCiAgICBwb3J0czoKICAgICAgaHR0cDogODAKCnN0b3JlZ2F0ZXdheToKICBlbmFibGVkOiB0cnVlCg==",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "M4"
}
}
},
"actions": [
{
"action_id": "health-check",
"params": {
"endpoint": "lb-thanos-query-frontend-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/thanos/queryfrontend/cypress"
},
"endpoint": "lb-thanos-query-frontend-http",
"app_protocol": "HTTP"
}
}
]
}
}
}