1
0
mirror of synced 2026-02-13 13:06:56 +00:00

implement testEnv for e2e tests

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
This commit is contained in:
Chanwit Kaewkasi
2021-08-08 00:54:42 +07:00
parent cb96bca6aa
commit 8f78263455
26 changed files with 376 additions and 44 deletions

View File

@@ -1,3 +1,5 @@
// +build !e2e
package main
import (
@@ -6,39 +8,43 @@ import (
func TestTraceNoArgs(t *testing.T) {
cmd := cmdTestCase{
args: "trace",
wantError: true,
goldenValue: "object name is required",
args: "trace",
testClusterMode: FakeClusterMode,
wantError: true,
goldenValue: "object name is required",
}
cmd.runTestCmd(t)
}
func TestTraceDeployment(t *testing.T) {
cmd := cmdTestCase{
args: "trace podinfo -n podinfo --kind deployment --api-version=apps/v1",
wantError: false,
goldenFile: "testdata/trace/deployment.txt",
objectFile: "testdata/trace/deployment.yaml",
args: "trace podinfo -n podinfo --kind deployment --api-version=apps/v1",
testClusterMode: FakeClusterMode,
wantError: false,
goldenFile: "testdata/trace/deployment.txt",
objectFile: "testdata/trace/deployment.yaml",
}
cmd.runTestCmd(t)
}
func TestTraceHelmRelease(t *testing.T) {
cmd := cmdTestCase{
args: "trace podinfo -n podinfo --kind HelmRelease --api-version=helm.toolkit.fluxcd.io/v2beta1",
wantError: false,
goldenFile: "testdata/trace/helmrelease.txt",
objectFile: "testdata/trace/helmrelease.yaml",
args: "trace podinfo -n podinfo --kind HelmRelease --api-version=helm.toolkit.fluxcd.io/v2beta1",
testClusterMode: FakeClusterMode,
wantError: false,
goldenFile: "testdata/trace/helmrelease.txt",
objectFile: "testdata/trace/helmrelease.yaml",
}
cmd.runTestCmd(t)
}
func TestTraceHelmReleaseMissingGitRef(t *testing.T) {
cmd := cmdTestCase{
args: "trace podinfo -n podinfo --kind HelmRelease --api-version=helm.toolkit.fluxcd.io/v2beta1",
wantError: false,
goldenFile: "testdata/trace/helmrelease-missing-git-ref.txt",
objectFile: "testdata/trace/helmrelease-missing-git-ref.yaml",
args: "trace podinfo -n podinfo --kind HelmRelease --api-version=helm.toolkit.fluxcd.io/v2beta1",
testClusterMode: FakeClusterMode,
wantError: false,
goldenFile: "testdata/trace/helmrelease-missing-git-ref.txt",
objectFile: "testdata/trace/helmrelease-missing-git-ref.yaml",
}
cmd.runTestCmd(t)
}