Created
September 13, 2025 12:20
-
-
Save ngotzmann/c8b3ac62527fa0f6f1923ed3a1c06403 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default async function () { | |
| const config = ansibleConfigLoader.getConfig('./configs/prod.yml'); | |
| const k8sGroup = getGroupConfig(config, 'kubernetes'); | |
| const ungroupedConfig = getUngroupedConfig(config); | |
| describe('Validate otel collector, prometheus and grafana is running on k8s', () => { | |
| const k8s = new Kubernetes({ | |
| config_path: ungroupedConfig.k8s_admin_cert_path | |
| }); | |
| validateDeployment({ | |
| k8sClient: k8s, | |
| name: 'grafana', | |
| namespace: k8sGroup.group_vars.grafana_namespace | |
| }); | |
| validateDeployment({ | |
| k8sClient: k8s, | |
| name: 'prometheus-server', | |
| namespace: k8sGroup.group_vars.prometheus_namespace | |
| }); | |
| validateDeployment({ | |
| k8sClient: k8s, | |
| name: 'opentelmetry-collector', | |
| namespace: k8sGroup.group_vars.otel_namespace | |
| }); | |
| }); | |
| describe('Send dummy metrics to otel collector', () => { | |
| sendDummyMetric(k8sGroup); | |
| }); | |
| // sleep to wait until otel processed our call | |
| sleep(5); | |
| describe('Validate dummy metrics inside prometheus with added tenant', () => { | |
| checkPrometheusContainsMetrics(k8sGroup); | |
| }); | |
| describe('Validate grafana, works and contains metrics', async () => { | |
| await validateGrafanaLoginWorks(k8sGroup.group_vars.grafana_hostname, { | |
| username: k8sGroup.group_vars.grafana_username, | |
| password: k8sGroup.group_vars.grafana_password | |
| }); | |
| checkPromMetricsViaGrafanaApi(k8sGroup); | |
| }); | |
| } | |
| function validateDeployment(config: DeploymentConfig) { | |
| expect(config.name).to.not.be.empty; | |
| expect(config.namespace).to.not.be.empty; | |
| const deployment = config.k8sClient.get('Deployment.apps', config.name, config.namespace); | |
| if (config.replicas) { | |
| expect(deployment.status.readyReplicas).to.equal(config.replicas); | |
| } else { | |
| expect(deployment.status.readyReplicas).to.equal(deployment.status.replicas); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment