Need for Assert
based hooks #15
Description
Motivation
In the present times, Kubernetes developers need to write lot of code (w.r.t Golang) to test their controllers. It ranges from use of Ginkgo, Gomega, fake objects, standard testing package & the list continues. This issue acts as a placeholder to put thoughts to simplify this testing effort and make it more agile (when thought in terms of time taken to write this code, maintenance, rework, integrating with DAG based pipelines, integrating with CI/CD tooling, etc).
High Level Thoughts
One of the thoughts to simplify writing test code is to have Metac support Assert
based hooks on the lines of Sync
& Finalize
hooks. Metac is already a kubernetes based level triggered reconcile system which makes it similar to Directed Acyclic Graph
(DAG) based solution. In addition, if assert based hooks can enable writing assertion logic in query based language(s) that understand structured document models such as JSON, this entire process of writing test logic becomes simpler. A developer / tester needs to only assert the JSON document to test various controller scenarios.
Using Metac, a developer need to only write test logic in a declarative style. Whereas this developer gets much more in return, which are:
- Kubernetes itself becomes the CI/CD platform,
- Declarative test specs are executed as DAG
- No need to write assertion in high level languages like Golang, Python, JavaScript, etc that require specific skill set.
How to write test logic as declarative specifications?
Rego is something that I am contemplating with. However, there can be more that I am not aware of.