mirror of
https://github.com/bitnami/charts.git
synced 2026-04-02 07:17:26 +08:00
[bitnami/opencart] Add Opencart Helm Chart Test (#10593)
* Added antiflake pipeline Signed-off-by: alukic <alukic@vmware.com> * Diversified the pipeline Signed-off-by: alukic <alukic@vmware.com> * Make a change to trigger TKG Signed-off-by: alukic <alukic@vmware.com> * Replaced FIPS with normal AKS Signed-off-by: alukic <alukic@vmware.com> * Added extra workflow for Grafana Loki Signed-off-by: alukic <alukic@vmware.com> * Changed the pipeline Signed-off-by: alukic <alukic@vmware.com> * Modified the workflow Signed-off-by: alukic <alukic@vmware.com> * Removed Grafana Loki Signed-off-by: alukic <alukic@vmware.com> * Undo airflow change Signed-off-by: alukic <alukic@vmware.com> * Remove the antiflake pipeline Signed-off-by: alukic <alukic@vmware.com> * Change target ip, trigger tests Signed-off-by: alukic <alukic@vmware.com> * Change the runtime parameters Signed-off-by: alukic <alukic@vmware.com> * Added at least one Goss test Signed-off-by: alukic <alukic@vmware.com> * Added 5 Goss tests Signed-off-by: alukic <alukic@vmware.com> * Trigger the tests Signed-off-by: alukic <alukic@vmware.com> * Added enough tests Signed-off-by: alukic <alukic@vmware.com> * Changed the logo Signed-off-by: alukic <alukic@vmware.com> * Remove a sign Signed-off-by: alukic <alukic@vmware.com> * Applied PR suggestions Signed-off-by: alukic <alukic@vmware.com> * PR change Signed-off-by: alukic <alukic@vmware.com> * Applied PR suggestions for Opencart Signed-off-by: alukic <alukic@vmware.com> * Replaced IP with variable Signed-off-by: alukic <alukic@vmware.com>
This commit is contained in:
12
.vib/opencart/cypress/cypress.json
Normal file
12
.vib/opencart/cypress/cypress.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"env": {
|
||||
"username": "user",
|
||||
"password": "ComplicatedPassword123!4",
|
||||
"smtpHost": "smtptesthost",
|
||||
"smtpUser": "smtpUser"
|
||||
},
|
||||
"hosts": {
|
||||
"vmware-opencart.my": "{{ TARGET_IP }}"
|
||||
},
|
||||
"defaultCommandTimeout": 30000
|
||||
}
|
||||
5
.vib/opencart/cypress/cypress/fixtures/downloads.json
Normal file
5
.vib/opencart/cypress/cypress/fixtures/downloads.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"newDownload": {
|
||||
"name": "download-file"
|
||||
}
|
||||
}
|
||||
12
.vib/opencart/cypress/cypress/fixtures/guests.json
Normal file
12
.vib/opencart/cypress/cypress/fixtures/guests.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"newGuest": {
|
||||
"firstName": "Abigail",
|
||||
"lastName": "Somersat",
|
||||
"email": "abby@example.com",
|
||||
"phone": "653111345",
|
||||
"address": "Summer Street 13",
|
||||
"city": "Midland",
|
||||
"postCode": "02003",
|
||||
"zone": "Angus"
|
||||
}
|
||||
}
|
||||
BIN
.vib/opencart/cypress/cypress/fixtures/images/logo.png
Normal file
BIN
.vib/opencart/cypress/cypress/fixtures/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
7
.vib/opencart/cypress/cypress/fixtures/products.json
Normal file
7
.vib/opencart/cypress/cypress/fixtures/products.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"newProduct": {
|
||||
"name": "Cherry digital device",
|
||||
"metatagTitle": "device",
|
||||
"model": "CheryDig"
|
||||
}
|
||||
}
|
||||
9
.vib/opencart/cypress/cypress/fixtures/users.json
Normal file
9
.vib/opencart/cypress/cypress/fixtures/users.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"newUser": {
|
||||
"firstName": "Jane",
|
||||
"lastName": "Eyre",
|
||||
"email": "janeeyre@example.com",
|
||||
"phone": "653111345",
|
||||
"password": "someComplicatedPass12345!"
|
||||
}
|
||||
}
|
||||
111
.vib/opencart/cypress/cypress/integration/opencart_spec.js
Normal file
111
.vib/opencart/cypress/cypress/integration/opencart_spec.js
Normal file
@@ -0,0 +1,111 @@
|
||||
/// <reference types="cypress" />
|
||||
import { random } from './utils';
|
||||
|
||||
it('allows a user to register', () => {
|
||||
cy.visit('/index.php?route=account/login');
|
||||
cy.contains('Continue').click();
|
||||
cy.fixture('users').then((user) => {
|
||||
cy.get('#input-firstname').type(`${user.newUser.firstName}.${random}`);
|
||||
cy.get('#input-lastname').type(`${user.newUser.lastName}.${random}`);
|
||||
cy.get('#input-email').type(`${random}.${user.newUser.email}`);
|
||||
cy.get('#input-telephone').type(user.newUser.phone);
|
||||
cy.get('#input-password').type(`${user.newUser.password}.${random}`);
|
||||
cy.get('#input-confirm').type(`${user.newUser.password}.${random}`);
|
||||
});
|
||||
cy.get('[type="checkbox"]').check();
|
||||
cy.contains('Continue').click();
|
||||
cy.contains('Your Account Has Been Created');
|
||||
});
|
||||
|
||||
it('allows a user to place an order and an admin to list it', () => {
|
||||
cy.visit('/desktops/mac');
|
||||
cy.contains('Add to Cart').click();
|
||||
cy.contains('.alert', 'Success');
|
||||
cy.get('.btn-inverse').click();
|
||||
cy.contains('Checkout').click();
|
||||
cy.contains('Guest Checkout').click();
|
||||
cy.get('#button-account').click();
|
||||
cy.fixture('guests').then((guest) => {
|
||||
cy.get('#input-payment-firstname').type(
|
||||
`${guest.newGuest.firstName}.${random}`
|
||||
);
|
||||
cy.get('#input-payment-lastname').type(
|
||||
`${guest.newGuest.lastName}.${random}`
|
||||
);
|
||||
cy.get('#input-payment-email').type(`${guest.newGuest.email}`);
|
||||
cy.get('#input-payment-telephone').type(guest.newGuest.phone);
|
||||
cy.get('#input-payment-address-1').type(`${guest.newGuest.address}`);
|
||||
cy.get('#input-payment-city').type(guest.newGuest.city);
|
||||
cy.get('#input-payment-postcode').type(guest.newGuest.postCode);
|
||||
cy.get('#input-payment-zone').select(guest.newGuest.zone);
|
||||
});
|
||||
cy.get('#button-guest').click();
|
||||
cy.get('#button-shipping-method').click();
|
||||
cy.get('[name="agree"]').check();
|
||||
cy.get('#button-payment-method').click();
|
||||
cy.get('#button-confirm').click();
|
||||
cy.contains('Your order has been placed!');
|
||||
cy.login();
|
||||
cy.contains('Sales').click();
|
||||
cy.contains('Orders').click();
|
||||
cy.fixture('guests').then((guest) => {
|
||||
cy.contains(`${guest.newGuest.firstName}.${random}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('allows an admin to add a product to the catalog', () => {
|
||||
cy.login();
|
||||
cy.contains('Catalog').click();
|
||||
cy.contains('Product').click();
|
||||
cy.get('[data-original-title="Add New"]').click();
|
||||
cy.fixture('products').then((product) => {
|
||||
cy.get('#input-name1').type(`${product.newProduct.name}.${random}`);
|
||||
cy.get('#input-meta-title1').type(product.newProduct.metatagTitle);
|
||||
cy.contains('Data').click();
|
||||
cy.get('#input-model').type(product.newProduct.model);
|
||||
cy.get('[data-original-title="Save"]').click();
|
||||
cy.contains('Success');
|
||||
cy.visit('/');
|
||||
cy.get('.form-control').type(
|
||||
`${product.newProduct.name}.${random} {enter}`
|
||||
);
|
||||
cy.get('#content').contains(`${product.newProduct.name}.${random}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('checks if SMTP is configured as per the chart', () => {
|
||||
cy.login();
|
||||
cy.contains('System').click();
|
||||
cy.contains('Settings').click();
|
||||
cy.get('[data-original-title="Edit"]').click();
|
||||
cy.contains('[data-toggle="tab"]', 'Mail').click();
|
||||
cy.get('#input-mail-smtp-hostname').should(
|
||||
'have.value',
|
||||
Cypress.env('smtpHost')
|
||||
);
|
||||
cy.get('#input-mail-smtp-username').should(
|
||||
'have.value',
|
||||
Cypress.env('smtpUser')
|
||||
);
|
||||
});
|
||||
|
||||
it('allows the admin to upload a file', () => {
|
||||
cy.login();
|
||||
cy.contains('Catalog').click();
|
||||
cy.contains('Downloads').click();
|
||||
cy.get('[data-original-title="Add New"]').click();
|
||||
cy.fixture('downloads').then((download) => {
|
||||
cy.get('#button-upload').click();
|
||||
cy.get('input[type="file"]').selectFile(
|
||||
'cypress/fixtures/images/logo.png',
|
||||
{
|
||||
force: true,
|
||||
}
|
||||
);
|
||||
cy.get('[placeholder="Download Name"]').type(
|
||||
`${download.newDownload.name}.${random}`
|
||||
);
|
||||
});
|
||||
cy.get('[data-original-title="Save"]').click();
|
||||
cy.contains('Success: You have modified downloads!');
|
||||
});
|
||||
3
.vib/opencart/cypress/cypress/integration/utils.js
Normal file
3
.vib/opencart/cypress/cypress/integration/utils.js
Normal file
@@ -0,0 +1,3 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export let random = (Math.random() + 1).toString(36).substring(7);
|
||||
40
.vib/opencart/cypress/cypress/support/commands.js
Normal file
40
.vib/opencart/cypress/cypress/support/commands.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const COMMAND_DELAY = 500;
|
||||
const BASE_URL = 'http://vmware-opencart.my';
|
||||
|
||||
for (const command of ['click']) {
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
const origVal = originalFn(...args);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(origVal);
|
||||
}, COMMAND_DELAY);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Due to a bug when using "hosts" in Cypress, we cannot set a "baseUrl" in the
|
||||
// cypress.json file. Workaround this by modifying the "visit" command to preprend
|
||||
// the base URL.
|
||||
//
|
||||
// Further details: https://github.com/cypress-io/cypress/issues/20647
|
||||
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
|
||||
return originalFn(`${BASE_URL}${url}`, options);
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
'login',
|
||||
(username = Cypress.env('username'), password = Cypress.env('password')) => {
|
||||
cy.visit('/admin');
|
||||
cy.get('.panel-title');
|
||||
cy.get('#input-username').type(username);
|
||||
cy.get('#input-password').type(password);
|
||||
cy.contains('button', 'Login').click();
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.on('uncaught:exception', (err, runnable) => {
|
||||
if (err.message.includes('Unexpected token')) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
20
.vib/opencart/cypress/cypress/support/index.js
Normal file
20
.vib/opencart/cypress/cypress/support/index.js
Normal file
@@ -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')
|
||||
27
.vib/opencart/goss/goss.yaml
Normal file
27
.vib/opencart/goss/goss.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
command:
|
||||
user-id-test:
|
||||
exec: if [ "$(id -u)" -eq 0 ]; then exit 1; fi
|
||||
exit-status: 0
|
||||
stdout: []
|
||||
stderr: []
|
||||
file:
|
||||
/opt/bitnami/apache/conf/extra/httpd-manual.conf:
|
||||
mode: "0664"
|
||||
filetype: file
|
||||
exists: true
|
||||
/opt/bitnami/opencart/config.php:
|
||||
mode: "0777"
|
||||
filetype: symlink
|
||||
exists: true
|
||||
contains:
|
||||
- vmware-opencart
|
||||
- mysqli
|
||||
- 3306
|
||||
/opt/bitnami/opencart/system/config:
|
||||
mode: "0775"
|
||||
filetype: directory
|
||||
exists: true
|
||||
/opt/bitnami/mysql:
|
||||
mode: "0755"
|
||||
filetype: directory
|
||||
exists: true
|
||||
@@ -17,14 +17,57 @@
|
||||
]
|
||||
},
|
||||
"verify": {
|
||||
"context": {
|
||||
"resources": {
|
||||
"url": "{SHA_ARCHIVE}",
|
||||
"path": "/bitnami/opencart"
|
||||
},
|
||||
"runtime_parameters": "c2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czogCiAgICBodHRwOiA4MApvcGVuY2FydEhvc3Q6IHZtd2FyZS1vcGVuY2FydC5teQpvcGVuY2FydFVzZXJuYW1lOiB1c2VyCm9wZW5jYXJ0UGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApzbXRwSG9zdDogc210cHRlc3Rob3N0CnNtdHBVc2VyOiBzbXRwVXNlcgpzbXRwUGFzc3dvcmQ6IHNtdHBDb21wbGljYXRlZFBhc3N3b3JkMTIzITQKc210cFBvcnQ6IDk0MjEK",
|
||||
"target_platform": {
|
||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||
"size": {
|
||||
"name": "M4"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"action_id": "trivy",
|
||||
"params": {
|
||||
"threshold": "CRITICAL",
|
||||
"vuln_type": [
|
||||
"OS"
|
||||
]
|
||||
"vuln_type": ["OS"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "health-check",
|
||||
"params": {
|
||||
"endpoint": "lb-opencart-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/opencart/goss"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "deploy-opencart"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "cypress",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/opencart/cypress"
|
||||
},
|
||||
"endpoint": "lb-opencart-http",
|
||||
"app_protocol": "HTTP",
|
||||
"env": {
|
||||
"username": "user",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -17,6 +17,19 @@
|
||||
]
|
||||
},
|
||||
"verify": {
|
||||
"context": {
|
||||
"resources": {
|
||||
"url": "{SHA_ARCHIVE}",
|
||||
"path": "/bitnami/opencart"
|
||||
},
|
||||
"runtime_parameters": "c2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czogCiAgICBodHRwOiA4MApvcGVuY2FydEhvc3Q6IHZtd2FyZS1vcGVuY2FydC5teQpvcGVuY2FydFVzZXJuYW1lOiB1c2VyCm9wZW5jYXJ0UGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApzbXRwSG9zdDogc210cHRlc3Rob3N0CnNtdHBVc2VyOiBzbXRwVXNlcgpzbXRwUGFzc3dvcmQ6IHNtdHBDb21wbGljYXRlZFBhc3N3b3JkMTIzITQKc210cFBvcnQ6IDk0MjEK",
|
||||
"target_platform": {
|
||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||
"size": {
|
||||
"name": "M4"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"action_id": "trivy",
|
||||
@@ -24,6 +37,38 @@
|
||||
"threshold": "CRITICAL",
|
||||
"vuln_type": ["OS"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "health-check",
|
||||
"params": {
|
||||
"endpoint": "lb-opencart-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/opencart/goss"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "deploy-opencart"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "cypress",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/opencart/cypress"
|
||||
},
|
||||
"endpoint": "lb-opencart-http",
|
||||
"app_protocol": "HTTP",
|
||||
"env": {
|
||||
"username": "user",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user