-
- Downloads
Add tests for flux trace command
Add tests for flux trace command that fake out the kubernetes client, load objects from a yaml file and create them in the client, and assert on the output of the trace command to an expected golden file. This is a follow up from the suggestions in PR https://github.com/fluxcd/flux2/pull/1626 which suggested that additional testing would be helpful. This test approach is modeled after the helm command tests. This required some changes to the kubernetes client setup to make it possible to use a fake. If we agree this pattern makes sense, it can be applied to other commands. Signed-off-by:Allen Porter <allen@thebends.org>
Showing
- cmd/flux/main.go 13 additions, 0 deletionscmd/flux/main.go
- cmd/flux/testdata/trace/deployment.txt 26 additions, 0 deletionscmd/flux/testdata/trace/deployment.txt
- cmd/flux/testdata/trace/deployment.yaml 129 additions, 0 deletionscmd/flux/testdata/trace/deployment.yaml
- cmd/flux/testdata/trace/helmrelease-missing-git-ref.txt 19 additions, 0 deletionscmd/flux/testdata/trace/helmrelease-missing-git-ref.txt
- cmd/flux/testdata/trace/helmrelease-missing-git-ref.yaml 73 additions, 0 deletionscmd/flux/testdata/trace/helmrelease-missing-git-ref.yaml
- cmd/flux/testdata/trace/helmrelease.txt 20 additions, 0 deletionscmd/flux/testdata/trace/helmrelease.txt
- cmd/flux/testdata/trace/helmrelease.yaml 75 additions, 0 deletionscmd/flux/testdata/trace/helmrelease.yaml
- cmd/flux/testdata/trace/no-args.txt 1 addition, 0 deletionscmd/flux/testdata/trace/no-args.txt
- cmd/flux/trace.go 3 additions, 3 deletionscmd/flux/trace.go
- cmd/flux/trace_test.go 180 additions, 0 deletionscmd/flux/trace_test.go
- go.mod 2 additions, 0 deletionsgo.mod
- go.sum 2 additions, 0 deletionsgo.sum
- internal/utils/utils.go 34 additions, 9 deletionsinternal/utils/utils.go
Loading
Please register or sign in to comment