Fix typos and ask unittest (#1235)
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
279d7dee18
commit
4b3ad24bc7
|
|
@ -48,7 +48,7 @@ func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
|||
f.StringVar(&syncOptions.PostRenderer, "post-renderer", "", `pass --post-renderer to "helm template" or "helm upgrade --install"`)
|
||||
f.StringArrayVar(&syncOptions.PostRendererArgs, "post-renderer-args", nil, `pass --post-renderer-args to "helm template" or "helm upgrade --install"`)
|
||||
f.StringVar(&syncOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
|
||||
f.StringVar(&syncOptions.DryRyn, "dry-run", "", "pass dry-run to helm exec")
|
||||
f.StringVar(&syncOptions.DryRun, "dry-run", "", "pass dry-run to helm exec")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ type ApplyOptions struct {
|
|||
// SyncArgs is the list of arguments to pass to helm upgrade.
|
||||
SyncArgs string
|
||||
// DryRun is for helm dry-run flag
|
||||
DryRyn string
|
||||
DryRun string
|
||||
}
|
||||
|
||||
// NewApply creates a new Apply
|
||||
|
|
@ -252,5 +252,5 @@ func (a *ApplyImpl) SyncArgs() string {
|
|||
|
||||
// DryRun returns dry-run flag
|
||||
func (a *ApplyImpl) DryRun() string {
|
||||
return a.ApplyOptions.DryRyn
|
||||
return a.ApplyOptions.DryRun
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ type SyncOptions struct {
|
|||
// SyncArgs is the list of arguments to pass to the helm upgrade command.
|
||||
SyncArgs string
|
||||
// DryRun is for helm dry-run flag
|
||||
DryRyn string
|
||||
DryRun string
|
||||
}
|
||||
|
||||
// NewSyncOptions creates a new Apply
|
||||
|
|
@ -144,5 +144,5 @@ func (t *SyncImpl) SyncArgs() string {
|
|||
|
||||
// DryRun returns dry-run flag
|
||||
func (t *SyncImpl) DryRun() string {
|
||||
return t.SyncOptions.DryRyn
|
||||
return t.SyncOptions.DryRun
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,3 +276,42 @@ func TestAppendShowOnlyFlags(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppendDryRunFlags(t *testing.T) {
|
||||
type args struct {
|
||||
flags []string
|
||||
dry-run string
|
||||
helm helmexec.Interface
|
||||
expected []string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
}{
|
||||
{
|
||||
name: "do dry-run on client",
|
||||
args: args{
|
||||
flags: []string{},
|
||||
dry-run: "client",
|
||||
helm: testutil.NewVersionHelmExec("3.12.1"),
|
||||
expected: []string{"--dry-run", "client"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "do dry-run on server",
|
||||
args: args{
|
||||
flags: []string{},
|
||||
dry-run: "server",
|
||||
helm: testutil.NewVersionHelmExec("3.12.1"),
|
||||
expected: []string{"--dry-run", "server"},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
st := &HelmState{}
|
||||
got := st.appendDryRunFlags(tt.args.flags, tt.args.helm, tt.args.release, tt.args.dry-run)
|
||||
require.Equalf(t, tt.args.expected, got, "appendDryRunFlags() = %v, want %v", got, tt.args.expected)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue