Fixed problem in unit test where error expected/actual comparison was not being performed
Kubernetes-commit: 97185e97529ef7c006f26bb3190805ad28f15ffe
This commit is contained in:
parent
b69c2a4389
commit
e9f1eb93f4
|
@ -107,7 +107,7 @@ func TestPluginPathsAreValid(t *testing.T) {
|
|||
pluginFile: func() (*os.File, error) {
|
||||
return ioutil.TempFile(tempDir, "notkubectl-")
|
||||
},
|
||||
expectErr: "unable to find any kubectl plugins in your PATH",
|
||||
expectErr: "error: unable to find any kubectl plugins in your PATH\n",
|
||||
},
|
||||
{
|
||||
name: "ensure de-duplicated plugin-paths slice",
|
||||
|
@ -138,8 +138,6 @@ func TestPluginPathsAreValid(t *testing.T) {
|
|||
|
||||
PluginPaths: test.pluginPaths,
|
||||
}
|
||||
o.Out = out
|
||||
o.ErrOut = errOut
|
||||
|
||||
// create files
|
||||
if test.pluginFile != nil {
|
||||
|
@ -158,10 +156,11 @@ func TestPluginPathsAreValid(t *testing.T) {
|
|||
|
||||
err := o.Run()
|
||||
if err == nil && len(test.expectErr) > 0 {
|
||||
t.Fatalf("unexpected non-error: expecting %v", test.expectErr)
|
||||
}
|
||||
if err != nil && len(test.expectErr) == 0 {
|
||||
t.Fatalf("unexpected error: %v - %v", err, errOut.String())
|
||||
t.Fatalf("unexpected non-error: expected %v, but got nothing", test.expectErr)
|
||||
} else if err != nil && len(test.expectErr) == 0 {
|
||||
t.Fatalf("unexpected error: expected nothing, but got %v", err.Error())
|
||||
} else if err != nil && err.Error() != test.expectErr {
|
||||
t.Fatalf("unexpected error: expected %v, but got %v", test.expectErr, err.Error())
|
||||
}
|
||||
|
||||
if len(test.expectErrOut) == 0 && errOut.Len() > 0 {
|
||||
|
|
Loading…
Reference in New Issue