diff --git a/src/cli/backup/exchange_e2e_test.go b/src/cli/backup/exchange_e2e_test.go index 587888d47..ebc675b59 100644 --- a/src/cli/backup/exchange_e2e_test.go +++ b/src/cli/backup/exchange_e2e_test.go @@ -117,7 +117,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestBackupCreateExchange_azureIDFromC "--config-file", suite.cfgFP) cli.BuildCommandTree(cmd) - cmd.SetErr(&suite.recorder) + cmd.SetOut(&suite.recorder) ctx = print.SetRootCmd(ctx, cmd) @@ -143,10 +143,11 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestExchangeBackupValueFromEnvCmd_emp cmd := cliTD.StubRootCmd( "backup", "create", "exchange", - "--user", suite.m365UserID) + "--user", suite.m365UserID, + "--config-file", suite.cfgFP) cli.BuildCommandTree(cmd) - cmd.SetErr(&suite.recorder) + cmd.SetOut(&suite.recorder) ctx = print.SetRootCmd(ctx, cmd) @@ -178,7 +179,7 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestExchangeBackupInvalidAWSClientIDC ) cli.BuildCommandTree(cmd) - cmd.SetErr(&suite.recorder) + cmd.SetOut(&suite.recorder) ctx = print.SetRootCmd(ctx, cmd) @@ -199,10 +200,12 @@ func (suite *ExchangeCMDWithFlagsE2ESuite) TestExchangeBackupAWSValueFromEnvCmd_ cmd := cliTD.StubRootCmd( "backup", "create", "exchange", - "--user", suite.m365UserID) + "--user", suite.m365UserID, + "--config-file", suite.cfgFP) + cli.BuildCommandTree(cmd) - cmd.SetErr(&suite.recorder) + cmd.SetOut(&suite.recorder) ctx = print.SetRootCmd(ctx, cmd) diff --git a/src/cli/config/storage.go b/src/cli/config/storage.go index 2d23e71cc..bfa154ca1 100644 --- a/src/cli/config/storage.go +++ b/src/cli/config/storage.go @@ -20,11 +20,6 @@ import ( func s3ConfigsFromViper(vpr *viper.Viper) (storage.S3Config, error) { var s3Config storage.S3Config - providerType := vpr.GetString(StorageProviderTypeKey) - if providerType != storage.ProviderS3.String() { - return s3Config, clues.New("unsupported storage provider: " + providerType) - } - s3Config.Bucket = vpr.GetString(BucketNameKey) s3Config.Endpoint = vpr.GetString(EndpointKey) s3Config.Prefix = vpr.GetString(PrefixKey) @@ -83,6 +78,11 @@ func configureStorage( } if matchFromConfig { + providerType := vpr.GetString(StorageProviderTypeKey) + if providerType != storage.ProviderS3.String() { + return store, clues.New("unsupported storage provider: " + providerType) + } + if err := mustMatchConfig(vpr, s3Overrides(overrides)); err != nil { return store, clues.Wrap(err, "verifying s3 configs in corso config file") } diff --git a/src/cli/repo/s3_e2e_test.go b/src/cli/repo/s3_e2e_test.go index 57e8b91c4..540d08836 100644 --- a/src/cli/repo/s3_e2e_test.go +++ b/src/cli/repo/s3_e2e_test.go @@ -132,7 +132,11 @@ func (suite *S3E2ESuite) TestInitS3Cmd_missingBucket() { cfg, err := st.S3Config() require.NoError(t, err, clues.ToCore(err)) - vpr, configFP := tconfig.MakeTempTestConfigClone(t, nil) + force := map[string]string{ + tconfig.TestCfgBucket: "", + } + + vpr, configFP := tconfig.MakeTempTestConfigClone(t, force) ctx = config.SetViper(ctx, vpr) diff --git a/src/pkg/storage/testdata/storage.go b/src/pkg/storage/testdata/storage.go index e9db2834e..f2a181d43 100644 --- a/src/pkg/storage/testdata/storage.go +++ b/src/pkg/storage/testdata/storage.go @@ -7,7 +7,6 @@ import ( "github.com/alcionai/clues" "github.com/stretchr/testify/require" - "github.com/alcionai/corso/src/cli/flags" "github.com/alcionai/corso/src/internal/common/str" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig" @@ -58,7 +57,7 @@ func NewPrefixedS3Storage(t *testing.T) storage.Storage { func GetAndInsertCorso(passphase string) credentials.Corso { // fetch data from flag, env var or func param giving priority to func param // Func param generally will be value fetched from config file using viper. - corsoPassph := str.First(flags.CorsoPassphraseFV, os.Getenv(credentials.CorsoPassphrase), passphase) + corsoPassph := str.First(os.Getenv(credentials.CorsoPassphrase), passphase) return credentials.Corso{ CorsoPassphrase: corsoPassph,