mirror of
https://github.com/bitnami/charts.git
synced 2026-04-02 07:17:26 +08:00
[bitnami/grafana-loki] Add Grafana Loki Helm Chart Tests (#10674)
* 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 Grafana Loki tests Signed-off-by: alukic <alukic@vmware.com> * Made a change to trigger VIB Signed-off-by: alukic <alukic@vmware.com> * Fix the loki issue Signed-off-by: alukic <alukic@vmware.com> * Fixed a typo in folder names Signed-off-by: alukic <alukic@vmware.com> * Removed Cypress to check if that is the problem Signed-off-by: alukic <alukic@vmware.com> * Added back the Cypress action Signed-off-by: alukic <alukic@vmware.com> * Removed Trivy and Health Check temporarily Signed-off-by: alukic <alukic@vmware.com> * Fixed the notes Signed-off-by: alukic <alukic@vmware.com> * Fixed the issue with the Ingress Signed-off-by: alukic <alukic@vmware.com> * Updated the tests not to check for values Signed-off-by: alukic <alukic@vmware.com> * Added extra workflow for Grafana Loki Signed-off-by: alukic <alukic@vmware.com> * Added Grafana tests Signed-off-by: alukic <alukic@vmware.com> * Changed pipeline name Signed-off-by: alukic <alukic@vmware.com> * Changed the pipeline Signed-off-by: alukic <alukic@vmware.com> * Added 5 Goss tests Signed-off-by: alukic <alukic@vmware.com> * Changed the names of the pipelines Signed-off-by: alukic <alukic@vmware.com> * Modified the workflow Signed-off-by: alukic <alukic@vmware.com> * Empty-Commit * Fixed an issue with the Goss action Signed-off-by: alukic <alukic@vmware.com> * Fix a workload typo Signed-off-by: alukic <alukic@vmware.com> * Changed the runtime_params Signed-off-by: alukic <alukic@vmware.com> * Removed Grafana Loki Signed-off-by: alukic <alukic@vmware.com> * Add changes to trigger VIB Signed-off-by: alukic <alukic@vmware.com> * Remove extra test files Signed-off-by: alukic <alukic@vmware.com> * Removed RBAC Signed-off-by: alukic <alukic@vmware.com> * Fixed an error from my side Signed-off-by: alukic <alukic@vmware.com> * Fix Goss test Signed-off-by: alukic <alukic@vmware.com> * Improved the Goss tests Signed-off-by: alukic <alukic@vmware.com> * Trying to fix the remaining test Signed-off-by: alukic <alukic@vmware.com> * Change nginx t test Signed-off-by: alukic <alukic@vmware.com> * Removed output test Signed-off-by: alukic <alukic@vmware.com> * Add back the faling test just to see something Signed-off-by: alukic <alukic@vmware.com> * Make the Goss tests fail Signed-off-by: alukic <alukic@vmware.com> * Removed a failing test Signed-off-by: alukic <alukic@vmware.com> * Removed unrelated changes Signed-off-by: alukic <alukic@vmware.com> * Removed unelated files Signed-off-by: alukic <alukic@vmware.com> * Synced the pipelines Signed-off-by: alukic <alukic@vmware.com> * Added VIB triggering changes Signed-off-by: alukic <alukic@vmware.com> * Fixing the endpoint Signed-off-by: alukic <alukic@vmware.com> * Fix the endpoints Signed-off-by: alukic <alukic@vmware.com> * Linter Signed-off-by: alukic <alukic@vmware.com> * Remove environment variables Signed-off-by: alukic <alukic@vmware.com> * Remove extra params Signed-off-by: alukic <alukic@vmware.com> * Remove commands file Signed-off-by: alukic <alukic@vmware.com> * Add more Goss tests Signed-off-by: alukic <alukic@vmware.com> * Removed extra files Signed-off-by: alukic <alukic@vmware.com> * Change the path as it was wrong Signed-off-by: alukic <alukic@vmware.com> * Added a separate goss file for a test of a different pod Signed-off-by: alukic <alukic@vmware.com> * Removed extra changes Signed-off-by: alukic <alukic@vmware.com> * Reordered some files Signed-off-by: alukic <alukic@vmware.com> * Make changes to the folder structure Signed-off-by: alukic <alukic@vmware.com> * Trigger VIB again * Change the spec and the body Signed-off-by: alukic <alukic@vmware.com> * Trigger VIB to run tests Signed-off-by: alukic <alukic@vmware.com> * Undo VIB changes for real branch Signed-off-by: alukic <alukic@vmware.com> * Removed extra files Signed-off-by: alukic <alukic@vmware.com> * Fixed a test with an issue Signed-off-by: alukic <alukic@vmware.com> * Remove console logs Signed-off-by: alukic <alukic@vmware.com> * Remove extra empty line Signed-off-by: alukic <alukic@vmware.com>
This commit is contained in:
4
.vib/grafana-loki/cypress/cypress.json
Normal file
4
.vib/grafana-loki/cypress/cypress.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"baseUrl": "http://localhost",
|
||||
"responseTimeout": 30000
|
||||
}
|
||||
10
.vib/grafana-loki/cypress/cypress/fixtures/logs-body.json
Normal file
10
.vib/grafana-loki/cypress/cypress/fixtures/logs-body.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"streams": [
|
||||
{
|
||||
"stream": {
|
||||
"label": "value"
|
||||
},
|
||||
"values": [["1655215460780999999", "value"]]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/// <reference types="cypress" />
|
||||
import body from '../fixtures/logs-body.json';
|
||||
|
||||
it('shows build info endpoint', () => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/loki/api/v1/status/buildinfo',
|
||||
form: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body).to.include.all.keys(
|
||||
'version',
|
||||
'revision',
|
||||
'branch',
|
||||
'buildUser',
|
||||
'goVersion'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('allows Loki to get Grafana logs', () => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: 'loki/api/v1/query?query={app="grafana-loki"}',
|
||||
form: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers['content-type']).to.eq(
|
||||
'application/json; charset=UTF-8'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('checks Loki range endpoint', () => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: 'loki/api/v1/query?query={job="varlogs"}',
|
||||
form: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.headers['content-type']).to.eq(
|
||||
'application/json; charset=UTF-8'
|
||||
);
|
||||
expect(response.body.data.stats.summary).not.to.be.empty;
|
||||
expect(response.body.data.stats).to.include.all.keys(
|
||||
'summary',
|
||||
'querier',
|
||||
'ingester'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('can publish and retrieve a label', () => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json; charset=utf-8' },
|
||||
url: 'loki/api/v1/push',
|
||||
body: body,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(204);
|
||||
});
|
||||
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: 'loki/api/v1/label/label/values',
|
||||
form: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body.data).to.contain('value');
|
||||
});
|
||||
});
|
||||
|
||||
it('can get a list of series', () => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: 'loki/api/v1/series',
|
||||
form: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
17
.vib/grafana-loki/goss/gateway/goss.yaml
Normal file
17
.vib/grafana-loki/goss/gateway/goss.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
file:
|
||||
/opt/bitnami/nginx/conf/nginx.conf:
|
||||
mode: "0644"
|
||||
filetype: file
|
||||
exists: true
|
||||
/app/index.html:
|
||||
mode: "0644"
|
||||
filetype: file
|
||||
exists: true
|
||||
contains:
|
||||
- "Welcome to nginx!"
|
||||
command:
|
||||
user-id-test:
|
||||
exec: if [ "$(id -u)" -eq 0 ]; then exit 1; fi
|
||||
exit-status: 0
|
||||
stdout: []
|
||||
stderr: []
|
||||
9
.vib/grafana-loki/goss/querier/goss.yaml
Normal file
9
.vib/grafana-loki/goss/querier/goss.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
file:
|
||||
/opt/bitnami/grafana-loki/bin/loki:
|
||||
mode: "0755"
|
||||
filetype: file
|
||||
exists: true
|
||||
/opt/bitnami/grafana-loki/bin/logcli:
|
||||
mode: "0755"
|
||||
filetype: file
|
||||
exists: true
|
||||
@@ -22,7 +22,7 @@
|
||||
"url": "{SHA_ARCHIVE}",
|
||||
"path": "/bitnami/grafana-loki"
|
||||
},
|
||||
"runtime_parameters": "ImdhdGV3YXkiOgogICJzZXJ2aWNlIjoKICAgICJwb3J0cyI6CiAgICAgICJodHRwIjogODAKICAgICJ0eXBlIjogIkxvYWRCYWxhbmNlciIK",
|
||||
"runtime_parameters": "Z2F0ZXdheToKICBzZXJ2aWNlOgogICAgcG9ydHM6CiAgICAgIGh0dHA6IDgwCiAgICB0eXBlOiBMb2FkQmFsYW5jZXIK",
|
||||
"target_platform": {
|
||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||
"size": {
|
||||
@@ -35,9 +35,7 @@
|
||||
"action_id": "trivy",
|
||||
"params": {
|
||||
"threshold": "CRITICAL",
|
||||
"vuln_type": [
|
||||
"OS"
|
||||
]
|
||||
"vuln_type": ["OS"]
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -46,6 +44,38 @@
|
||||
"endpoint": "lb-grafana-loki-gateway-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/grafana-loki/goss/gateway"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "deploy-grafana-loki-gateway"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/grafana-loki/goss/querier"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "sts-grafana-loki-querier"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "cypress",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/grafana-loki/cypress"
|
||||
},
|
||||
"endpoint": "lb-grafana-loki-gateway-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"url": "{SHA_ARCHIVE}",
|
||||
"path": "/bitnami/grafana-loki"
|
||||
},
|
||||
"runtime_parameters": "ImdhdGV3YXkiOgogICJzZXJ2aWNlIjoKICAgICJwb3J0cyI6CiAgICAgICJodHRwIjogODAKICAgICJ0eXBlIjogIkxvYWRCYWxhbmNlciIK",
|
||||
"runtime_parameters": "Z2F0ZXdheToKICBzZXJ2aWNlOgogICAgcG9ydHM6CiAgICAgIGh0dHA6IDgwCiAgICB0eXBlOiBMb2FkQmFsYW5jZXIK",
|
||||
"target_platform": {
|
||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||
"size": {
|
||||
@@ -35,9 +35,7 @@
|
||||
"action_id": "trivy",
|
||||
"params": {
|
||||
"threshold": "CRITICAL",
|
||||
"vuln_type": [
|
||||
"OS"
|
||||
]
|
||||
"vuln_type": ["OS"]
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -46,6 +44,38 @@
|
||||
"endpoint": "lb-grafana-loki-gateway-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/grafana-loki/goss/gateway"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "deploy-grafana-loki-gateway"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/grafana-loki/goss/querier"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "sts-grafana-loki-querier"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "cypress",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/grafana-loki/cypress"
|
||||
},
|
||||
"endpoint": "lb-grafana-loki-gateway-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user