INNER CODE UNIT · Go
Test_checkContextName
sunny0826/kubecm · cmd/add_test.go:213
func Test_checkContextName(t *testing.T) {
type args struct {
name string
oldConfig *clientcmdapi.Config
}
tests := []struct {
name string
args args
want bool
}{
// TODO: Add more test cases.
{"exist", args{name: "root-context", oldConfig: &addTestConfig}, true},
{"not-exist", args{name: "test", oldConfig: &addTestConfig}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := checkContextName(tt.args.name, tt.args.oldConfig); got != tt.want {
t.Errorf("checkContextName() = %v, want %v", got, tt.want)