diff --git a/pkg/supportbundle/supportbundle.go b/pkg/supportbundle/supportbundle.go index 45e1b70e9f..bde0ee5811 100644 --- a/pkg/supportbundle/supportbundle.go +++ b/pkg/supportbundle/supportbundle.go @@ -98,7 +98,7 @@ func GetSpecURI(appSlug string) string { } func GetBundleCommand(appSlug string) []string { - redactURIs := []string{redact.GetKotsadmRedactSpecURI(), redact.GetAppRedactSpecURI(appSlug)} + redactURIs := []string{redact.GetKotsadmRedactSpecURI(), redact.GetAppRedactSpecURI(appSlug), redact.GetDefaultRedactSpecURI()} redactors := strings.Join(redactURIs, ",") command := []string{ diff --git a/pkg/supportbundle/supportbundle_test.go b/pkg/supportbundle/supportbundle_test.go new file mode 100644 index 0000000000..04d1bb341b --- /dev/null +++ b/pkg/supportbundle/supportbundle_test.go @@ -0,0 +1,33 @@ +package supportbundle + +import ( + "fmt" + "strings" + "testing" + + "github.com/replicatedhq/kots/pkg/redact" + "github.com/replicatedhq/kots/pkg/util" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetBundleCommand(t *testing.T) { + origPodNamespace := util.PodNamespace + util.PodNamespace = "test-namespace" + defer func() { + util.PodNamespace = origPodNamespace + }() + + appSlug := "test-app" + command := GetBundleCommand(appSlug) + + require.Len(t, command, 2) + assert.Equal(t, "curl https://krew.sh/support-bundle | bash", command[0]) + + expectedRedactors := strings.Join([]string{ + redact.GetKotsadmRedactSpecURI(), + redact.GetAppRedactSpecURI(appSlug), + redact.GetDefaultRedactSpecURI(), + }, ",") + assert.Equal(t, fmt.Sprintf("kubectl support-bundle --load-cluster-specs --redactors=%s\n", expectedRedactors), command[1]) +}