elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
20 stars 144 forks source link

Add basic resource correctness tests for the elastic-agent Helm Chart #6014

Open swiatekm opened 6 days ago

swiatekm commented 6 days ago

Helm lets us generate whatever we want, as long as it's valid yaml. In order to check whether our manifests contain valid Kubernetes resources, we'd need to actually apply them to a running API Server, which is annoying to do if we want to run this kind of test for a lot of different values files.

However, we can instead simply load the manifests into the right struct in a standard Go test. This can be made fully dynamic as long as we register all the necessary schemas, and with packages like terratest, even rendering the manifests can be done within the Go test. Here's a working example of this idea: https://github.com/SumoLogic/sumologic-kubernetes-collection/blob/30d3c3ffb1d5d8bd87e76cf4285777c20a1bfdb4/tests/helm/common_test.go#L24.

elasticmachine commented 6 days ago

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)