mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-17 14:57:12 +00:00
38 lines
815 B
Go
38 lines
815 B
Go
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
|
|
"github.com/cloud-native-application/rudrx/pkg/test"
|
|
)
|
|
|
|
func TestNewTraitCommand(t *testing.T) {
|
|
TraitsNotApply := traitDefinitionExample.DeepCopy()
|
|
TraitsNotApply.Spec.AppliesToWorkloads = []string{}
|
|
|
|
cases := map[string]*test.CliTestCase{
|
|
"PrintTraits": {
|
|
Resources: test.InitResources{
|
|
Create: []runtime.Object{
|
|
traitDefinitionExample.DeepCopy(),
|
|
},
|
|
},
|
|
ExpectedString: "manualscalertrait.core.oam.dev",
|
|
Args: []string{},
|
|
},
|
|
"TraitsNotApply": {
|
|
Resources: test.InitResources{
|
|
Create: []runtime.Object{
|
|
TraitsNotApply,
|
|
},
|
|
},
|
|
ExpectedOutput: "NAME ALIAS DEFINITION APPLIES TO STATUS\n",
|
|
Args: []string{},
|
|
},
|
|
}
|
|
|
|
test.NewCliTest(t, scheme, NewTraitsCommand, cases).Run()
|
|
}
|