diff --git a/chart/Chart.lock b/chart/Chart.lock new file mode 100644 index 0000000000000000000000000000000000000000..507aa7ad3b4c7a0bd11101a6cb265f2793b0f122 --- /dev/null +++ b/chart/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: gluon + repository: oci://registry.dso.mil/platform-one/big-bang/apps/library-charts/gluon + version: 0.1.1 +digest: sha256:cf1107c00a11cde8074a39624643312fe85ee11250bb7d9380e3787bde0af0f7 +generated: "2021-06-01T10:06:05.8383699-06:00" diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 143e0cb764a245ee3501e4c0f3592adeb4cd14e8..571ee7b26cb879b5e297ee43b66fa2b3235cd000 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -1,4 +1,8 @@ apiVersion: v2 name: twistlock -version: 0.0.4-bb.2 +version: 0.0.4-bb.3 appVersion: 21.04.412 +dependencies: + - name: gluon + version: 0.1.1 + repository: oci://registry.dso.mil/platform-one/big-bang/apps/library-charts/gluon diff --git a/chart/charts/gluon-0.1.1.tgz b/chart/charts/gluon-0.1.1.tgz new file mode 100644 index 0000000000000000000000000000000000000000..b4a4878dae126348cdee9d80977a15121ba59f9f Binary files /dev/null and b/chart/charts/gluon-0.1.1.tgz differ diff --git a/chart/templates/tests/test-api.yaml b/chart/templates/tests/test-api.yaml new file mode 100644 index 0000000000000000000000000000000000000000..37e825efd18282fc75fa073b90dc866dbc6a026e --- /dev/null +++ b/chart/templates/tests/test-api.yaml @@ -0,0 +1,7 @@ +{{- include "gluon.tests.script-configmap.overrides" (list . "twistlock-test.script-configmap") }} +{{- define "twistlock-test.script-configmap" }} +{{- end }} +--- +{{- include "gluon.tests.script-runner.overrides" (list . "twistlock-test.script-runner") -}} +{{- define "twistlock-test.script-runner" -}} +{{- end }} diff --git a/chart/templates/tests/test-ui.yaml b/chart/templates/tests/test-ui.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c308e60753bec5f864f412dbef73c474eeb9140d --- /dev/null +++ b/chart/templates/tests/test-ui.yaml @@ -0,0 +1,7 @@ +{{- include "gluon.tests.cypress-configmap.overrides" (list . "twistlock-test.cypress-configmap") }} +{{- define "twistlock-test.cypress-configmap" }} +{{- end }} +--- +{{- include "gluon.tests.cypress-runner.overrides" (list . "twistlock-test.cypress-runner") -}} +{{- define "twistlock-test.cypress-runner" -}} +{{- end }} diff --git a/chart/tests/cypress/cypress.json b/chart/tests/cypress/cypress.json new file mode 100644 index 0000000000000000000000000000000000000000..e36f98472bbfea7bfc965e1a081f0b002af04859 --- /dev/null +++ b/chart/tests/cypress/cypress.json @@ -0,0 +1,5 @@ +{ + "pluginsFile": false, + "supportFile": false, + "fixturesFolder": false +} diff --git a/chart/tests/cypress/twistlock-health.spec.js b/chart/tests/cypress/twistlock-health.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..251bb659beca4d0f8f24ae37216b8fd863250c44 --- /dev/null +++ b/chart/tests/cypress/twistlock-health.spec.js @@ -0,0 +1,13 @@ +describe('Twistlock Healthcheck', function() { + it('Check console is accessible', function() { + cy.visit('/', { timeout: 5000 }) + cy.title().should('eq', 'Prisma Cloud') + }) + + /* Below section should work, but times out because either one of Cypress or Twistlock doesn't play nice. + it('Create admin user', function() { + cy.get('input[type="text"]').type("admin") + cy.get('input[type="password"]').type(Cypress.env('twistlock_password')) + cy.get('button[type="submit"]').click() + })*/ +}) diff --git a/chart/tests/scripts/check-api.sh b/chart/tests/scripts/check-api.sh new file mode 100644 index 0000000000000000000000000000000000000000..c49f607b3ab078c0c8f3d0c9478c7227be026cea --- /dev/null +++ b/chart/tests/scripts/check-api.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -ex + +echo "Hitting Twistlock API endpoint..." +curl -sISk -H 'Authorization: Basic "${api_auth}"' "${twistlock_host}/" &>/dev/null || export TW_DOWN="true" +if [[ ${TW_DOWN} == "true" ]]; then + echo "Test 1 Failure: Cannot hit Twistlock endpoint." + echo "Debug information (curl response):" + echo $(curl -k -H 'Authorization: Basic "${api_auth}"' "${twistlock_host}/") + exit 1 +fi +echo "Test 1 Success: Twistlock API is up." + +# A license is required to do more +#echo "Creating admin user for further testing" +#curl -k -H 'Content-Type: application/json' -XPOST -d '{"username": "admin", "password": "admin"}' "${twistlock_host}/api/v1/signup" &>/dev/null +#echo "Created admin user for further testing." +# +#echo "Hitting Twistlock API Version endpoint..." +#version_response=$(curl -k -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW46YWRtaW4=' "${twistlock_host}/api/v1/version" 2>/dev/null) +#current_version=$(echo ${version_response} | xargs) +#if [ ! ${desired_version} == ${current_version} ]; then +# echo "Test 2 Failure: Twistlock version does not match." +# echo "Debug information (curl response):" +# echo $(curl -k -H 'Content-Type: application/json' -H 'Authorization: Basic "${api_auth}"' "${twistlock_host}/api/v1/version") +# exit 1 +#fi +#echo "Test 2 Success: Twistlock Version Matches." diff --git a/tests/cypress.json b/tests/cypress.json deleted file mode 100644 index 81dd4b81e6e4781f8a65d0785bd3c2615cda2cf9..0000000000000000000000000000000000000000 --- a/tests/cypress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "pluginsFile": false, - "supportFile": false, - "fixturesFolder": false, - "env": { - "twistlock_url": "twistlock.bigbang.dev" - } -} diff --git a/tests/cypress/integration/twistlock-health.spec.js b/tests/cypress/integration/twistlock-health.spec.js deleted file mode 100644 index 7b2114ce8b18e8cc7b9d6db0c9638ea87e9d875e..0000000000000000000000000000000000000000 --- a/tests/cypress/integration/twistlock-health.spec.js +++ /dev/null @@ -1,6 +0,0 @@ -describe('Basic Twistlock Up', function() { - it('Check console is accessible', () => { - cy.visit(Cypress.env('twistlock_url')); - cy.title().should('eq', 'Prisma Cloud'); - }); -}) diff --git a/tests/test-values.yml b/tests/test-values.yml index 2986adb9924ae35cbd9a25a1d5751c7ed27cdcd5..520f8ce4bf5f38c86541b9e1d0a961fdb7cb2d24 100644 --- a/tests/test-values.yml +++ b/tests/test-values.yml @@ -7,3 +7,15 @@ imagePullSecrets: console: persistence: size: 5Gi + +bbtests: + enabled: true + cypress: + artifacts: true + envs: + cypress_baseUrl: "http://{{ .Release.Name }}-console.{{ .Release.Namespace }}.svc.cluster.local:8081" + scripts: + image: registry1.dso.mil/ironbank/stedolan/jq:1.6 + envs: + twistlock_host: "https://{{ .Release.Name }}-console.{{ .Release.Namespace }}.svc.cluster.local:8083" + desired_version: "{{ .Values.console.image.tag }}"