cli: fix apply flag issues (#2526)

* Fix flag order
* Fix missing phases in flag parsing

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-10-30 09:30:35 +01:00 committed by GitHub
parent e4d8bda792
commit a0863bafe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 29 deletions

View file

@ -283,26 +283,6 @@ func TestUpgradeApply(t *testing.T) {
}
}
func TestUpgradeApplyFlagsForSkipPhases(t *testing.T) {
require := require.New(t)
cmd := newUpgradeApplyCmd()
// register persistent flags manually
cmd.Flags().String("workspace", "", "")
cmd.Flags().Bool("force", true, "")
cmd.Flags().String("tf-log", "NONE", "")
cmd.Flags().Bool("debug", false, "")
cmd.Flags().Bool("merge-kubeconfig", false, "")
require.NoError(cmd.Flags().Set("skip-phases", "infrastructure,helm,k8s,image"))
wantPhases := skipPhases{}
wantPhases.add(skipInfrastructurePhase, skipHelmPhase, skipK8sPhase, skipImagePhase)
var flags applyFlags
err := flags.parse(cmd.Flags())
require.NoError(err)
assert.Equal(t, wantPhases, flags.skipPhases)
}
type stubKubernetesUpgrader struct {
nodeVersionErr error
currentConfig config.AttestationCfg