Skip to content

Commit 7eb521c

Browse files
authored
Merge pull request kubernetes#2357 from lingsamuel/fix-query-cmd
Fix query cmd `opts.Validate` and test func name
2 parents dbc48e6 + cfe0f62 commit 7eb521c

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

cmd/kepctl/query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func buildQueryCommand(k *kepctl.Client) *cobra.Command {
3232
Long: "Query the local filesystem, and optionally GitHub PRs for KEPs",
3333
Example: ` kepctl query --sig architecture --status provisional --include-prs`,
3434
PreRunE: func(cmd *cobra.Command, args []string) error {
35-
return opts.Validate(args)
35+
return opts.Validate()
3636
},
3737
RunE: func(cmd *cobra.Command, args []string) error {
3838
return k.Query(opts)

pkg/kepctl/query_test.go

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,47 @@ import (
2323
"github.com/stretchr/testify/require"
2424
)
2525

26-
27-
func TestValidate(t *testing.T) {
26+
func TestValidateQueryOpt(t *testing.T) {
2827
testcases := []struct {
2928
name string
3029
queryOpts QueryOpts
31-
err error
30+
err error
3231
}{
3332
{
3433
name: "Valid SIG",
3534
queryOpts: QueryOpts{
36-
CommonArgs: CommonArgs {
37-
Name: "1011-test",
35+
CommonArgs: CommonArgs{
36+
Name: "1011-test",
3837
},
39-
SIG: []string{"sig-multicluster"},
40-
IncludePRs: true,
41-
Output: "json",
38+
SIG: []string{"sig-multicluster"},
39+
IncludePRs: true,
40+
Output: "json",
4241
},
43-
err: nil,
42+
err: nil,
4443
},
4544
{
4645
name: "Invalid SIG",
4746
queryOpts: QueryOpts{
48-
CommonArgs: CommonArgs {
49-
Name: "1011-test-xyz",
47+
CommonArgs: CommonArgs{
48+
Name: "1011-test-xyz",
5049
},
51-
SIG: []string{"sig-xyz"},
52-
IncludePRs: true,
53-
Output: "json",
50+
SIG: []string{"sig-xyz"},
51+
IncludePRs: true,
52+
Output: "json",
5453
},
55-
err: fmt.Errorf("No SIG matches any of the passed regular expressions"),
54+
err: fmt.Errorf("No SIG matches any of the passed regular expressions"),
5655
},
5756
{
5857
name: "Unsupported Output format",
5958
queryOpts: QueryOpts{
60-
CommonArgs: CommonArgs {
61-
Name: "1011-test-testing",
59+
CommonArgs: CommonArgs{
60+
Name: "1011-test-testing",
6261
},
63-
SIG: []string{"sig-testing"},
64-
IncludePRs: true,
65-
Output: "PDF",
62+
SIG: []string{"sig-testing"},
63+
IncludePRs: true,
64+
Output: "PDF",
6665
},
67-
err: fmt.Errorf("unsupported output format: PDF. Valid values: [table json yaml]"),
66+
err: fmt.Errorf("unsupported output format: PDF. Valid values: [table json yaml]"),
6867
},
6968
}
7069

0 commit comments

Comments
 (0)