charmed-kubernetes / pytest-operator

Apache License 2.0
6 stars 13 forks source link

Add juju_run (and maybe kubectl) helper #22

Open johnsca opened 2 years ago

johnsca commented 2 years ago

Our tests frequently need to run commands on units to do things like interact with kubectl or issue workload queries (e.g., prometheus queries). There's a bit of boilerplate that is associated with that, such as: selecting a unit to run on, checking the response status and exit code, ensuring a reasonable timeout, etc. It would be nice to have a helper around that, and examples can already be found in kube-state-metrics-operator and kubernetes-master.

Definition of done:

Stretch goal:

johnsca commented 2 years ago

Now that actions-operator installs kubectl locally by default, I don't think the kubectl wrapper is required, since ops_test.run() should suffice. The only thing it's missing is a timeout param.