-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix counting plugins migrated, Doctor JSON schema and multi-word comm… (
- Loading branch information
1 parent
f48767a
commit 92c6236
Showing
7 changed files
with
83 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package execute | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestPluginExecutor_GetCommandPrefix(t *testing.T) { | ||
testCases := []struct { | ||
Name string | ||
In []string | ||
Expected string | ||
}{ | ||
{ | ||
Name: "Single command", | ||
In: []string{"kubectl"}, | ||
Expected: "kubectl", | ||
}, | ||
{ | ||
Name: "Single verb", | ||
In: []string{"kubectl", "get"}, | ||
Expected: "kubectl get", | ||
}, | ||
{ | ||
Name: "Multiple args", | ||
In: []string{"kubectl", "get", "pods", "-n", "default"}, | ||
Expected: "kubectl get", | ||
}, | ||
{ | ||
Name: "Multi-word verb", | ||
In: []string{"doctor", "can I ask a question"}, | ||
Expected: "doctor {multi-word arg}", | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
t.Run(tc.Name, func(t *testing.T) { | ||
p := &PluginExecutor{} | ||
|
||
// when | ||
out := p.GetCommandPrefix(tc.In) | ||
|
||
// then | ||
assert.Equal(t, tc.Expected, out) | ||
}) | ||
} | ||
} |