Skip to content

Commit

Permalink
Merge pull request #41344 from apprenda/kubeadm_token_test-cmds
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

kubeadm: test-cmd: token{delete}

**What this PR does / why we need it**: Adding test-cmds for kubeadm ex token delete. Will followup with more test-cmds for other flags as soon as validation for the flags works. 

Adding tests is a WIP from #34136

**Special notes for your reviewer**: /cc @luxas @pires 

**Release note**:
```release-note
NONE
```
  • Loading branch information
Kubernetes Submit Queue committed Feb 14, 2017
2 parents 7332baf + 288ef87 commit da8f68e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cmd/kubeadm/test/cmd/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,31 @@ func TestCmdTokenGenerateTypoError(t *testing.T) {
t.Error("'kubeadm ex token genorate' (a deliberate typo) exited without an error when we expected non-zero exit status")
}
}
func TestCmdTokenDelete(t *testing.T) {
if *kubeadmCmdSkip {
t.Log("kubeadm cmd tests being skipped")
t.Skip()
}

var tests = []struct {
args string
expected bool
}{
{"", false}, // no token provided
{"foobar", false}, // invalid token
}

for _, rt := range tests {
_, _, actual := RunCmd(*kubeadmPath, "ex", "token", "delete", rt.args)
if (actual == nil) != rt.expected {
t.Errorf(
"failed CmdTokenDelete running 'kubeadm ex token %s' with an error: %v\n\texpected: %t\n\t actual: %t",
rt.args,
actual,
rt.expected,
(actual == nil),
)
}
kubeadmReset()
}
}

0 comments on commit da8f68e

Please sign in to comment.