Skip to content

Commit

Permalink
test for 'kubectl' prefix in help strings (#551)
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
  • Loading branch information
ahmetb authored Mar 13, 2020
1 parent f7fed5b commit 927e4d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 36 deletions.
35 changes: 0 additions & 35 deletions cmd/krew/cmd/root_test.go

This file was deleted.

24 changes: 23 additions & 1 deletion integration_test/help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

package integrationtest

import "testing"
import (
"regexp"
"testing"
)

func TestKrewHelp(t *testing.T) {
skipShort(t)
Expand All @@ -27,3 +30,22 @@ func TestKrewHelp(t *testing.T) {
test.Krew("-h").RunOrFail()
test.Krew("--help").RunOrFail()
}

func TestRootHelpShowsKubectlPrefix(t *testing.T) {
skipShort(t)
test, cleanup := NewTest(t)
defer cleanup()

out := string(test.Krew("help").RunOrFailOutput())

expect := []*regexp.Regexp{
regexp.MustCompile(`(?m)Usage:\s+kubectl krew`),
regexp.MustCompile(`(?m)Use "kubectl krew`),
}

for _, e := range expect {
if !e.MatchString(out) {
t.Errorf("output does not have matching string to pattern %s ; output=%s", e, out)
}
}
}

0 comments on commit 927e4d7

Please sign in to comment.