diff --git a/.github/workflows/vib-thanos-bucketweb.yaml b/.github/workflows/vib-thanos-bucketweb.yaml new file mode 100644 index 0000000000..8d8379033f --- /dev/null +++ b/.github/workflows/vib-thanos-bucketweb.yaml @@ -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 }} diff --git a/.github/workflows/vib-thanos-queryfrontend.yaml b/.github/workflows/vib-thanos-queryfrontend.yaml new file mode 100644 index 0000000000..c8f0acaafe --- /dev/null +++ b/.github/workflows/vib-thanos-queryfrontend.yaml @@ -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 }} diff --git a/.vib/thanos/bucketweb/cypress/cypress.json b/.vib/thanos/bucketweb/cypress/cypress.json new file mode 100644 index 0000000000..ca7dfecb44 --- /dev/null +++ b/.vib/thanos/bucketweb/cypress/cypress.json @@ -0,0 +1,4 @@ +{ + "baseUrl": "http://localhost", + "defaultCommandTimeout": 40000 +} diff --git a/.vib/thanos/bucketweb/cypress/cypress/integration/thanos_bucketweb_spec.js b/.vib/thanos/bucketweb/cypress/cypress/integration/thanos_bucketweb_spec.js new file mode 100644 index 0000000000..f764400b62 --- /dev/null +++ b/.vib/thanos/bucketweb/cypress/cypress/integration/thanos_bucketweb_spec.js @@ -0,0 +1,19 @@ +/// + +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.'); +}); diff --git a/.vib/thanos/bucketweb/cypress/cypress/support/commands.js b/.vib/thanos/bucketweb/cypress/cypress/support/commands.js new file mode 100644 index 0000000000..f29beb28c5 --- /dev/null +++ b/.vib/thanos/bucketweb/cypress/cypress/support/commands.js @@ -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); + }); + }); +} diff --git a/.vib/thanos/bucketweb/cypress/cypress/support/index.js b/.vib/thanos/bucketweb/cypress/cypress/support/index.js new file mode 100644 index 0000000000..d68db96df2 --- /dev/null +++ b/.vib/thanos/bucketweb/cypress/cypress/support/index.js @@ -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') diff --git a/.vib/thanos/bucketweb/vib-platform-verify.json b/.vib/thanos/bucketweb/vib-platform-verify.json new file mode 100644 index 0000000000..b1560ca726 --- /dev/null +++ b/.vib/thanos/bucketweb/vib-platform-verify.json @@ -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" + } + } + ] + } + } + } diff --git a/.vib/thanos/queryfrontend/cypress/cypress.json b/.vib/thanos/queryfrontend/cypress/cypress.json new file mode 100644 index 0000000000..8184308823 --- /dev/null +++ b/.vib/thanos/queryfrontend/cypress/cypress.json @@ -0,0 +1,4 @@ +{ + "baseUrl": "http://localhost/", + "defaultCommandTimeout": 40000 +} diff --git a/.vib/thanos/queryfrontend/cypress/cypress/integration/thanos_queryfrontend_spec.js b/.vib/thanos/queryfrontend/cypress/cypress/integration/thanos_queryfrontend_spec.js new file mode 100644 index 0000000000..4ae8e34e63 --- /dev/null +++ b/.vib/thanos/queryfrontend/cypress/cypress/integration/thanos_queryfrontend_spec.js @@ -0,0 +1,42 @@ +/// + +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); +}); diff --git a/.vib/thanos/queryfrontend/cypress/cypress/support/commands.js b/.vib/thanos/queryfrontend/cypress/cypress/support/commands.js new file mode 100644 index 0000000000..c64f030fb3 --- /dev/null +++ b/.vib/thanos/queryfrontend/cypress/cypress/support/commands.js @@ -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); + }); + }); +} diff --git a/.vib/thanos/queryfrontend/cypress/cypress/support/index.js b/.vib/thanos/queryfrontend/cypress/cypress/support/index.js new file mode 100644 index 0000000000..37a498fb5b --- /dev/null +++ b/.vib/thanos/queryfrontend/cypress/cypress/support/index.js @@ -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') diff --git a/.vib/thanos/queryfrontend/vib-platform-verify.json b/.vib/thanos/queryfrontend/vib-platform-verify.json new file mode 100644 index 0000000000..9e259a02cd --- /dev/null +++ b/.vib/thanos/queryfrontend/vib-platform-verify.json @@ -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" + } + } + ] + } + } + }