mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-05 21:44:15 -04:00
cli: add version validation and force flag
Version validation checks that the configured versions are not more than one minor version below the CLI's version. The validation can be disabled using --force. This is necessary for now during development as the CLI does not have a prerelease version, as our images do.
This commit is contained in:
parent
3a7b829107
commit
f204c24174
29 changed files with 590 additions and 61 deletions
|
@ -36,6 +36,7 @@ func TestParseFetchMeasurementsFlags(t *testing.T) {
|
|||
urlFlag string
|
||||
signatureURLFlag string
|
||||
configFlag string
|
||||
forceFlag bool
|
||||
wantFlags *fetchMeasurementsFlags
|
||||
wantErr bool
|
||||
}{
|
||||
|
@ -74,6 +75,7 @@ func TestParseFetchMeasurementsFlags(t *testing.T) {
|
|||
|
||||
cmd := newConfigFetchMeasurementsCmd()
|
||||
cmd.Flags().String("config", constants.ConfigFilename, "") // register persistent flag manually
|
||||
cmd.Flags().Bool("force", false, "") // register persistent flag manually
|
||||
|
||||
if tc.urlFlag != "" {
|
||||
require.NoError(cmd.Flags().Set("url", tc.urlFlag))
|
||||
|
@ -243,10 +245,12 @@ func TestConfigFetchMeasurements(t *testing.T) {
|
|||
|
||||
cmd := newConfigFetchMeasurementsCmd()
|
||||
cmd.Flags().String("config", constants.ConfigFilename, "") // register persistent flag manually
|
||||
cmd.Flags().Bool("force", true, "") // register persistent flag manually
|
||||
fileHandler := file.NewHandler(afero.NewMemMapFs())
|
||||
|
||||
gcpConfig := defaultConfigWithExpectedMeasurements(t, config.Default(), cloudprovider.GCP)
|
||||
gcpConfig.Image = "v999.999.999"
|
||||
constants.VersionInfo = "v999.999.999"
|
||||
|
||||
err := fileHandler.WriteYAML(constants.ConfigFilename, gcpConfig, file.OptMkdirAll)
|
||||
require.NoError(err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue