mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-04 23:35:11 -04:00
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:
parent
e4d8bda792
commit
a0863bafe7
3 changed files with 35 additions and 29 deletions
|
@ -9,6 +9,7 @@ package cmd
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -149,3 +150,22 @@ func TestBackupHelmCharts(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSkipPhases(t *testing.T) {
|
||||
require := require.New(t)
|
||||
cmd := NewApplyCmd()
|
||||
// register persistent flags manually
|
||||
cmd.Flags().String("workspace", "", "")
|
||||
cmd.Flags().Bool("force", true, "")
|
||||
cmd.Flags().String("tf-log", "NONE", "")
|
||||
cmd.Flags().Bool("debug", false, "")
|
||||
|
||||
require.NoError(cmd.Flags().Set("skip-phases", strings.Join(allPhases(), ",")))
|
||||
wantPhases := skipPhases{}
|
||||
wantPhases.add(skipInfrastructurePhase, skipInitPhase, skipAttestationConfigPhase, skipCertSANsPhase, skipHelmPhase, skipK8sPhase, skipImagePhase)
|
||||
|
||||
var flags applyFlags
|
||||
err := flags.parse(cmd.Flags())
|
||||
require.NoError(err)
|
||||
assert.Equal(t, wantPhases, flags.skipPhases)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue