mirror of
https://github.com/bitnami/charts.git
synced 2026-04-02 15:27:08 +08:00
[bitnami/harbor] Revisit Goss/Cypress tests (#11502)
* [bitnami/harbor] Revisit Goss/Cypress tests Signed-off-by: FraPazGal <fdepaz@vmware.com> * Remove local testing folder Signed-off-by: FraPazGal <fdepaz@vmware.com> * Modify goss tests and update runtime_params Signed-off-by: FraPazGal <fdepaz@vmware.com>
This commit is contained in:
committed by
GitHub
parent
6ea7b13ca8
commit
3b422d06ac
@@ -1,20 +1,12 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
import { random } from '../support/utils';
|
import { random } from '../support/utils';
|
||||||
|
|
||||||
it('allows user to log in and log out', () => {
|
|
||||||
cy.login();
|
|
||||||
cy.contains('Invalid user name or password').should('not.exist');
|
|
||||||
cy.contains('button', 'admin').click();
|
|
||||||
cy.contains('Log Out').click();
|
|
||||||
cy.get('#login_username');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('allows creating a project', () => {
|
it('allows creating a project', () => {
|
||||||
cy.login();
|
cy.login();
|
||||||
cy.visit('/harbor/projects');
|
cy.visit('/harbor/projects');
|
||||||
cy.fixture('projects').then((project) => {
|
cy.fixture('projects').then((project) => {
|
||||||
cy.contains('button', 'New Project').click();
|
cy.contains('New Project').click();
|
||||||
cy.get('#create_project_name').type(`${project.newProject.name}-${random}`);
|
cy.get('[id*="project_name"]').type(`${project.newProject.name}-${random}`);
|
||||||
cy.contains('button', 'OK').should('not.be.disabled').click();
|
cy.contains('button', 'OK').should('not.be.disabled').click();
|
||||||
cy.contains('Created project successfully');
|
cy.contains('Created project successfully');
|
||||||
});
|
});
|
||||||
@@ -24,28 +16,31 @@ it('allows creating a registry', () => {
|
|||||||
cy.login();
|
cy.login();
|
||||||
cy.visit('/harbor/registries');
|
cy.visit('/harbor/registries');
|
||||||
cy.fixture('registries').then((registry) => {
|
cy.fixture('registries').then((registry) => {
|
||||||
cy.contains('button', 'New Endpoint').click();
|
cy.contains('New Endpoint').click();
|
||||||
cy.get('#adapter').select(`${registry.newRegistry.provider}`);
|
cy.get('#adapter').select(`${registry.newRegistry.provider}`);
|
||||||
cy.get('#destination_name').type(`${registry.newRegistry.name}-${random}`);
|
cy.get('#destination_name').type(`${registry.newRegistry.name}-${random}`);
|
||||||
|
cy.contains('Test Connection').should('not.be.disabled').click();
|
||||||
|
cy.contains('Connection tested successfully');
|
||||||
cy.contains('button', 'OK').should('not.be.disabled').click();
|
cy.contains('button', 'OK').should('not.be.disabled').click();
|
||||||
cy.contains('.datagrid-table', `${registry.newRegistry.name}-${random}`);
|
cy.contains('.datagrid-table', `${registry.newRegistry.name}-${random}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows launching a vulnerability scan', () => {
|
it('allows launching a vulnerability scan', () => {
|
||||||
const IMAGE_SCANNER = 'Trivy';
|
|
||||||
cy.login();
|
cy.login();
|
||||||
cy.visit('/harbor/interrogation-services/scanners');
|
cy.visit('/harbor/interrogation-services/scanners');
|
||||||
cy.contains('.datagrid-table', IMAGE_SCANNER);
|
cy.contains('.datagrid-row', 'Trivy').within(() => {
|
||||||
cy.contains('a', 'Vulnerability').click();
|
cy.contains('Enabled');
|
||||||
|
});
|
||||||
|
cy.contains('Vulnerability').click();
|
||||||
cy.contains('SCAN NOW').click();
|
cy.contains('SCAN NOW').click();
|
||||||
cy.contains('Trigger scan all successfully');
|
cy.contains('Trigger scan all successfully');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checks system configurations endpoint', () => {
|
it('checks every subcomponent status', () => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/api/v2.0/configurations',
|
url: '/api/v2.0/health',
|
||||||
form: true,
|
form: true,
|
||||||
auth: {
|
auth: {
|
||||||
username: Cypress.env('username'),
|
username: Cypress.env('username'),
|
||||||
@@ -53,12 +48,6 @@ it('checks system configurations endpoint', () => {
|
|||||||
},
|
},
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
expect(response.status).to.eq(200);
|
expect(response.status).to.eq(200);
|
||||||
expect(response.body).to.include.all.keys(
|
expect(response.body.status).to.eq('healthy');
|
||||||
'auth_mode',
|
|
||||||
'email_host',
|
|
||||||
'project_creation_restriction',
|
|
||||||
'scan_all_policy',
|
|
||||||
'self_registration'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
file:
|
|
||||||
# Checks basic index.html exists
|
|
||||||
/opt/bitnami/harbor/index.html:
|
|
||||||
exists: true
|
|
||||||
filetype: file
|
|
||||||
mode: "0644"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
# Checks server configuration exists
|
|
||||||
/opt/bitnami/nginx/conf/nginx.conf:
|
|
||||||
exists: true
|
|
||||||
filetype: file
|
|
||||||
mode: "0644"
|
|
||||||
owner: root
|
|
||||||
# Checks API documentation exists
|
|
||||||
/opt/bitnami/harbor/swagger.json:
|
|
||||||
exists: true
|
|
||||||
filetype: file
|
|
||||||
mode: "0644"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
http:
|
|
||||||
# Checks Harbor Portal and every subcomponent status
|
|
||||||
http://localhost:8080/api/v2.0/health:
|
|
||||||
method: GET
|
|
||||||
status: 200
|
|
||||||
body:
|
|
||||||
- "!unhealthy"
|
|
||||||
command:
|
|
||||||
# Checks the user running the container is non-root
|
|
||||||
user-id-test:
|
|
||||||
exec: id -u
|
|
||||||
exit-status: 0
|
|
||||||
stdout:
|
|
||||||
- 1001
|
|
||||||
stderr: []
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
file:
|
|
||||||
# Checks basic filesystem and binary related to registry management exists
|
|
||||||
/var/lib/registry:
|
|
||||||
exists: true
|
|
||||||
filetype: directory
|
|
||||||
mode: "0775"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
/storage:
|
|
||||||
exists: true
|
|
||||||
filetype: directory
|
|
||||||
mode: "2775"
|
|
||||||
owner: root
|
|
||||||
/opt/bitnami/harbor-registry/bin/registry:
|
|
||||||
exists: true
|
|
||||||
filetype: file
|
|
||||||
mode: "0755"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
command:
|
|
||||||
# Checks the user running the container is non-root
|
|
||||||
user-id-test:
|
|
||||||
exec: id -u
|
|
||||||
exit-status: 0
|
|
||||||
stdout:
|
|
||||||
- 1001
|
|
||||||
stderr: []
|
|
||||||
20
.vib/harbor/goss/goss.yaml
Normal file
20
.vib/harbor/goss/goss.yaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
file:
|
||||||
|
/etc/registry/config.yml:
|
||||||
|
exists: true
|
||||||
|
filetype: file
|
||||||
|
mode: "0644"
|
||||||
|
owner: root
|
||||||
|
contains:
|
||||||
|
- "level: {{ .Vars.logLevel }}"
|
||||||
|
- "rootdirectory: {{ .Vars.persistence.imageChartStorage.filesystem.rootdirectory }}"
|
||||||
|
- "addr: localhost:{{ .Vars.registry.server.containerPorts.debug }}"
|
||||||
|
{{ .Vars.persistence.imageChartStorage.filesystem.rootdirectory }}:
|
||||||
|
exists: true
|
||||||
|
filetype: directory
|
||||||
|
mode: "2775"
|
||||||
|
owner: root
|
||||||
|
/etc/registry/root.crt:
|
||||||
|
exists: true
|
||||||
|
filetype: file
|
||||||
|
mode: "0644"
|
||||||
|
owner: root
|
||||||
9
.vib/harbor/goss/vars.yaml
Normal file
9
.vib/harbor/goss/vars.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
logLevel: debug
|
||||||
|
persistence:
|
||||||
|
imageChartStorage:
|
||||||
|
filesystem:
|
||||||
|
rootdirectory: /storage
|
||||||
|
registry:
|
||||||
|
server:
|
||||||
|
containerPorts:
|
||||||
|
debug: 5001
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"url": "{SHA_ARCHIVE}",
|
"url": "{SHA_ARCHIVE}",
|
||||||
"path": "/bitnami/harbor"
|
"path": "/bitnami/harbor"
|
||||||
},
|
},
|
||||||
"runtime_parameters": "ImFkbWluUGFzc3dvcmQiOiAiQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0IgoiZXhwb3N1cmVUeXBlIjogInByb3h5IgoicG9zdGdyZXNxbCI6CiAgImF1dGgiOgogICAgInBvc3RncmVzUGFzc3dvcmQiOiAiN2RNeExmY3F4TiIKInNlcnZpY2UiOgogICJwb3J0cyI6CiAgICAiaHR0cCI6IDgwCiAgInR5cGUiOiAiTG9hZEJhbGFuY2VyIgo=",
|
"runtime_parameters": "YWRtaW5QYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CmV4cG9zdXJlVHlwZTogcHJveHkKc2VydmljZToKICBwb3J0czoKICAgIGh0dHBzOiA0NDMKICB0eXBlOiBMb2FkQmFsYW5jZXIKbG9nTGV2ZWw6IGRlYnVnCnBlcnNpc3RlbmNlOgogIGltYWdlQ2hhcnRTdG9yYWdlOgogICAgZmlsZXN5c3RlbToKICAgICAgcm9vdGRpcmVjdG9yeTogL3N0b3JhZ2UKcmVnaXN0cnk6CiAgc2VydmVyOgogICAgY29udGFpbmVyUG9ydHM6CiAgICAgIGRlYnVnOiA1MDAx",
|
||||||
"target_platform": {
|
"target_platform": {
|
||||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||||
"size": {
|
"size": {
|
||||||
@@ -42,22 +42,12 @@
|
|||||||
"action_id": "goss",
|
"action_id": "goss",
|
||||||
"params": {
|
"params": {
|
||||||
"resources": {
|
"resources": {
|
||||||
"path": "/.vib/harbor/goss/goss-portal"
|
"path": "/.vib/harbor/goss"
|
||||||
},
|
|
||||||
"remote": {
|
|
||||||
"workload": "deploy-harbor-portal"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"action_id": "goss",
|
|
||||||
"params": {
|
|
||||||
"resources": {
|
|
||||||
"path": "/.vib/harbor/goss/goss-registry"
|
|
||||||
},
|
},
|
||||||
"remote": {
|
"remote": {
|
||||||
"workload": "deploy-harbor-registry"
|
"workload": "deploy-harbor-registry"
|
||||||
}
|
},
|
||||||
|
"vars_file": "vars.yaml"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"url": "{SHA_ARCHIVE}",
|
"url": "{SHA_ARCHIVE}",
|
||||||
"path": "/bitnami/harbor"
|
"path": "/bitnami/harbor"
|
||||||
},
|
},
|
||||||
"runtime_parameters": "ImFkbWluUGFzc3dvcmQiOiAiQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0IgoiZXhwb3N1cmVUeXBlIjogInByb3h5IgoicG9zdGdyZXNxbCI6CiAgImF1dGgiOgogICAgInBvc3RncmVzUGFzc3dvcmQiOiAiN2RNeExmY3F4TiIKInNlcnZpY2UiOgogICJwb3J0cyI6CiAgICAiaHR0cCI6IDgwCiAgInR5cGUiOiAiTG9hZEJhbGFuY2VyIgo=",
|
"runtime_parameters": "YWRtaW5QYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CmV4cG9zdXJlVHlwZTogcHJveHkKc2VydmljZToKICBwb3J0czoKICAgIGh0dHBzOiA0NDMKICB0eXBlOiBMb2FkQmFsYW5jZXIKbG9nTGV2ZWw6IGRlYnVnCnBlcnNpc3RlbmNlOgogIGltYWdlQ2hhcnRTdG9yYWdlOgogICAgZmlsZXN5c3RlbToKICAgICAgcm9vdGRpcmVjdG9yeTogL3N0b3JhZ2UKcmVnaXN0cnk6CiAgc2VydmVyOgogICAgY29udGFpbmVyUG9ydHM6CiAgICAgIGRlYnVnOiA1MDAx",
|
||||||
"target_platform": {
|
"target_platform": {
|
||||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||||
"size": {
|
"size": {
|
||||||
@@ -42,22 +42,12 @@
|
|||||||
"action_id": "goss",
|
"action_id": "goss",
|
||||||
"params": {
|
"params": {
|
||||||
"resources": {
|
"resources": {
|
||||||
"path": "/.vib/harbor/goss/goss-portal"
|
"path": "/.vib/harbor/goss"
|
||||||
},
|
|
||||||
"remote": {
|
|
||||||
"workload": "deploy-harbor-portal"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"action_id": "goss",
|
|
||||||
"params": {
|
|
||||||
"resources": {
|
|
||||||
"path": "/.vib/harbor/goss/goss-registry"
|
|
||||||
},
|
},
|
||||||
"remote": {
|
"remote": {
|
||||||
"workload": "deploy-harbor-registry"
|
"workload": "deploy-harbor-registry"
|
||||||
}
|
},
|
||||||
|
"vars_file": "vars.yaml"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user