Hey folks,
I'm working on using Jsonnet through Grafana Tanka to handle Kubernetes configurations. Up until now, I've been using Terraform for some things and it isn't exactly excellent for Kubernetes stuff.
One thing I was used to, however, was a range of options for testing my code. I've seen a few different options for Jsonnet but they all seem very old and searching in this forum, I don't see a lot of recent discussion on this.
I've gotten testonnet to work but one puzzle I've had is how to do negative tests; things like: passing invalid values to functions and verifying my validation logic is correct. This appears to be a problem because problems of this type appear to end up in errors or asserts and there seems to be no mechanism in Jsonnet to catch them. That would seem to make it hard to write a test that says "expect Jsonnet to throw an error for this value".
Has there been any evolution on this topic? Or is it possible that I need to evolve my design understanding to do this a different way?
At present, my only other thought was using something like Terratest with golang to invoke jsonnet or tanka from the outside and then catching the errors from the interpreter to check for negative test cases and validating the output for positive test cases. I would have liked to do this all in one language since we've already done Terraform/Terratest and it has been a common complaint from my team about having to deal with two languages to write code and test it effectively.
Thank you in advance for any thoughts on the topic.