Skip to content

Commit

Permalink
Corrupt TestSuite File should NOT Panic (#100)
Browse files Browse the repository at this point in the history
Signed-off-by: Ken Sipe <[email protected]>
  • Loading branch information
kensipe authored May 18, 2020
1 parent def706a commit 4bb104f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/kuttlctl/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1"
"github.com/kudobuilder/kuttl/pkg/test"
Expand Down Expand Up @@ -87,7 +88,13 @@ For more detailed documentation, visit: https://kudo.dev/docs/testing`,
kind := obj.GetObjectKind().GroupVersionKind().Kind

if kind == "TestSuite" {
options = *obj.(*harness.TestSuite)
switch ts := obj.(type) {
case *harness.TestSuite:
options = *ts
case *unstructured.Unstructured:
log.Println(fmt.Errorf("bad configuration in file %q", configPath))
}

} else {
log.Println(fmt.Errorf("unknown object type: %s", kind))
}
Expand Down

0 comments on commit 4bb104f

Please sign in to comment.