[bitnami/owncloud] Add Helm Chart tests for Owncloud (#10561)

* 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>

* Added the publish and verify pipelines

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

* Added Cypress tests

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

* Add one Goss tests

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

* Trigger VIB

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

* Change workload value

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

* Add more Goss tests

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

* Added the host settings just in case

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

* Removed the host settings

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

* Modified the pipeline to add .my to the domain

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

* Added target IP instead of the hardcoded value

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

* Added one more Goss test

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

* Modify the group for the Goss file

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

* Undo VIB changes and remove test files

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

* Delete antiflake

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

* Using fixtures

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

* Test data change

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

* Added a change to trigger VIB

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

* Remove extra params

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

* Updated the version and changed the readme

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

* Apply CR suggestions

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

* Applied CR suggestions

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

* Made changes as per PR review

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

* Replaced IP with parameter

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

* Changed plural values to singular

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

* Change the Goss file

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

* Change the Goss test

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

* Change IP

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

* Removed extra changes

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

* Improved the tests

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

* Replaced hardcoded IP

Signed-off-by: alukic <alukic@vmware.com>
This commit is contained in:
superaleks
2022-06-21 10:00:47 +02:00
committed by GitHub
parent 6bfba4852d
commit e48c7bea50
14 changed files with 297 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
{
"pageLoadTimeout": 240000,
"defaultCommandTimeout": 8000,
"viewportWidth": 1200,
"viewportHeight": 860,
"env": {
"username": "user",
"password": "ComplicatedPassword123!4",
"smtpHost": "smtptesthost",
"smtpUser": "smtpUser",
"owncloudEmail": "test@example.com"
},
"hosts": {
"vmware-owncloud.my": "{{ TARGET_IP }}"
}
}

View File

@@ -0,0 +1,5 @@
{
"newDomain": {
"domain": "http://vmware.com"
}
}

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,5 @@
{
"newFolder": {
"name": "test-folder"
}
}

View File

@@ -0,0 +1,5 @@
{
"newGroup": {
"name": "test-group"
}
}

View File

@@ -0,0 +1,5 @@
{
"newLink": {
"name": "very-cool-link"
}
}

View File

@@ -0,0 +1,6 @@
{
"newUser": {
"name": "pug",
"email": "pugsemail@email.com"
}
}

View File

@@ -0,0 +1,80 @@
/// <reference types="cypress" />
import { random } from './utils';
it('allows creating a folder and uploading a file ', () => {
cy.login();
cy.get('.new').click();
cy.get('[data-action="folder"]').click();
cy.fixture('folders').then((folder) => {
cy.get('[value="New folder"]').type(`${folder.newFolder.name}.${random}`);
cy.contains('Create').click();
cy.contains('.innernametext', `${folder.newFolder.name}.${random}`).click();
});
cy.get('.new').click();
cy.get('[data-action="upload"]').click();
cy.get('input[type="file"]').selectFile(
'cypress/fixtures/file_to_upload.json',
{ force: true }
);
cy.contains('No files in here').should('not.be.visible');
});
it('allows adding a group and a user', () => {
cy.login();
cy.visit('/index.php/settings/users');
cy.contains('Add Group').click();
cy.fixture('groups').then((group) => {
cy.get('#newgroupname').type(`${group.newGroup.name}.${random}`);
cy.get('#newgroup-form').within(() => {
cy.get('[type="submit"]').click();
});
cy.contains('.groupname', `${group.newGroup.name}.${random}`);
});
cy.fixture('users').then((user) => {
cy.get('#newusername').type(`${user.newUser.name}.${random}`);
cy.get('#newemail').type(`${user.newUser.email}.${random}`);
cy.contains('Create').click();
cy.contains('.name', `${user.newUser.name}.${random}`);
});
});
it('checks the SMTP configuration', () => {
cy.login();
cy.visit('/index.php/settings/admin?sectionid=general');
cy.get('#mail_smtphost').should('have.value', Cypress.env('smtpHost'));
cy.get('#mail_smtpname').should('have.value', Cypress.env('smtpUser'));
cy.get('#mail_to_address').should('have.value', Cypress.env('owncloudEmail'));
});
it('allows sharing a file by link', () => {
cy.login();
cy.get('[data-file="ownCloud Manual.pdf"]').within(() => {
cy.get('[data-action="Share"]').click();
});
cy.get('[class="permalink"]').click();
cy.get('.detailFileInfoContainer').within(() => {
cy.get('input')
.invoke('val')
.should('contain', 'vmware')
.then((link) => {
cy.request({
method: 'GET',
url: link,
form: true,
}).then((response) => {
expect(response.status).to.eq(200);
});
});
});
});
it('allows whitelisting a domain', () => {
cy.login();
cy.visit('/index.php/settings/personal');
cy.contains('Security').click();
cy.fixture('domains').then((domain) => {
cy.get('#domain').type(`${domain.newDomain.domain}`);
cy.get('#corsAddNewDomain').click();
cy.contains('.grid', `${domain.newDomain.domain}`);
});
});

View File

@@ -0,0 +1,3 @@
/// <reference types="cypress" />
export let random = (Math.random() + 1).toString(36).substring(7);

View File

@@ -0,0 +1,34 @@
const COMMAND_DELAY = 800;
const BASE_URL = 'http://vmware-owncloud.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);
});
});
}
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('/');
cy.get('.v-align');
cy.get('#user').type(username);
cy.get('#password').type(password);
cy.get('#submit').click();
cy.get('body').then(($body) => {
if ($body.text().includes('A safe home')) {
cy.get('#closeWizard').click();
}
});
}
);

View 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')

View File

@@ -0,0 +1,26 @@
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/mysql:
mode: "0755"
filetype: directory
exists: true
/bitnami/owncloud/data:
mode: "0770"
filetype: directory
exists: true
/opt/bitnami/owncloud/config/config.php:
mode: "0777"
filetype: symlink
exists: true
contains:
- {{ printf "/dbuser.*%s/" .Env.OWNCLOUD_DATABASE_USER }}
- {{ printf "/dbpassword.*%s/" .Env.OWNCLOUD_DATABASE_PASSWORD }}

View File

@@ -17,14 +17,57 @@
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/owncloud"
},
"runtime_parameters": "b3duY2xvdWRIb3N0OiB2bXdhcmUtb3duY2xvdWQubXkKb3duY2xvdWRVc2VybmFtZTogdXNlcgpvd25jbG91ZFBhc3N3b3JkOiBDb21wbGljYXRlZFBhc3N3b3JkMTIzITQKb3duY2xvdWRFbWFpbDogdGVzdEBleGFtcGxlLmNvbQpzZXJ2aWNlOgogIHR5cGU6IExvYWRCYWxhbmNlcgogIHBvcnRzOgogICAgaHR0cDogODAKc210cEhvc3Q6IHNtdHB0ZXN0aG9zdApzbXRwUG9ydDogOTgyMQpzbXRwVXNlcjogc210cFVzZXIKc210cFBhc3N3b3JkOiBzbXRwQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0",
"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-owncloud-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib/owncloud/goss"
},
"remote": {
"workload": "deploy-owncloud"
}
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/owncloud/cypress"
},
"endpoint": "lb-owncloud-http",
"app_protocol": "HTTP",
"env": {
"username": "user",
"password": "ComplicatedPassword123!4"
}
}
}
]

View File

@@ -17,6 +17,19 @@
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/owncloud"
},
"runtime_parameters": "b3duY2xvdWRIb3N0OiB2bXdhcmUtb3duY2xvdWQubXkKb3duY2xvdWRVc2VybmFtZTogdXNlcgpvd25jbG91ZFBhc3N3b3JkOiBDb21wbGljYXRlZFBhc3N3b3JkMTIzITQKb3duY2xvdWRFbWFpbDogdGVzdEBleGFtcGxlLmNvbQpzZXJ2aWNlOgogIHR5cGU6IExvYWRCYWxhbmNlcgogIHBvcnRzOgogICAgaHR0cDogODAKc210cEhvc3Q6IHNtdHB0ZXN0aG9zdApzbXRwUG9ydDogOTgyMQpzbXRwVXNlcjogc210cFVzZXIKc210cFBhc3N3b3JkOiBzbXRwQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0",
"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-owncloud-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib/owncloud/goss"
},
"remote": {
"workload": "deploy-owncloud"
}
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/owncloud/cypress"
},
"endpoint": "lb-owncloud-http",
"app_protocol": "HTTP",
"env": {
"username": "user",
"password": "ComplicatedPassword123!4"
}
}
}
]
}