Skip to content

Commit c0a11f0

Browse files
authored
Tony/remove data source (#63)
* Add actions to krew plugin * Remove -s * Update test --------- Co-authored-by: Tony Meehan <[email protected]>
1 parent bcc09cc commit c0a11f0

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

cmd/plugin/krew/krew.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ func RootCmd(ctx context.Context, o *krewOptions) *cobra.Command {
125125
cmd.Flags().BoolVarP(&cli.Options.Disabled, "disabled", "d", false, ux.HelpDisabled)
126126
cmd.Flags().BoolVarP(&cli.Options.Cron, "cron", "j", false, ux.HelpCron)
127127
cmd.Flags().BoolVarP(&cli.Options.Generate, "generate", "g", false, ux.HelpGenerate)
128-
cmd.Flags().StringVarP(&cli.Options.Source, "source", "s", "", ux.HelpSource)
129128
cmd.Flags().StringVarP(&cli.Options.Level, "level", "l", "", ux.HelpLevel)
130129
cmd.Flags().StringVarP(&cli.Options.Name, "name", "o", "", ux.HelpName)
131130
cmd.Flags().BoolVarP(&cli.Options.Quiet, "quiet", "q", false, ux.HelpQuiet)

test/cli_parity_test.go

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package test
22

33
import (
4-
"context"
5-
"reflect"
6-
"strings"
7-
"testing"
8-
9-
krewpkg "github.com/prequel-dev/preq/cmd/plugin/krew"
10-
"github.com/prequel-dev/preq/internal/pkg/cli"
11-
"github.com/google/go-cmp/cmp"
12-
"github.com/spf13/pflag"
13-
"k8s.io/cli-runtime/pkg/genericclioptions"
4+
"context"
5+
"reflect"
6+
"strings"
7+
"testing"
8+
9+
"github.com/google/go-cmp/cmp"
10+
krewpkg "github.com/prequel-dev/preq/cmd/plugin/krew"
11+
"github.com/prequel-dev/preq/internal/pkg/cli"
12+
"github.com/spf13/pflag"
13+
"k8s.io/cli-runtime/pkg/genericclioptions"
1414
)
1515

1616
func flagNameFromField(name string) string {
@@ -48,12 +48,18 @@ func krewFlagSet() map[string]struct{} {
4848
}
4949

5050
func TestKrewAndCLIMatch(t *testing.T) {
51-
cliFlags := cliFlagSet()
52-
krewFlags := krewFlagSet()
51+
cliFlags := cliFlagSet()
52+
krewFlags := krewFlagSet()
53+
54+
// Remove source flag from CLI flags if it's missing in krew
55+
// This allows krew to be missing the source flag without failing the test
56+
if _, exists := krewFlags["source"]; !exists {
57+
delete(cliFlags, "source")
58+
}
5359

54-
if diff := cmp.Diff(cliFlags, krewFlags); diff != "" {
55-
t.Fatalf("flags mismatch (-cli +krew):\n%s", diff)
56-
}
60+
if diff := cmp.Diff(cliFlags, krewFlags); diff != "" {
61+
t.Fatalf("flags mismatch (-cli +krew):\n%s", diff)
62+
}
5763
}
5864

5965
func TestCoverageOutput(t *testing.T) {

0 commit comments

Comments
 (0)