Compare commits

...

3 Commits

Author SHA1 Message Date
neha-Gupta1
bf309321af fix sanity test 2023-07-03 11:15:52 +05:30
neha-Gupta1
95ac1d2aa2 testcase fix 2023-06-30 16:03:43 +05:30
neha-Gupta1
4d8ddec6ef don't match config in init repo 2023-06-30 12:09:37 +05:30
3 changed files with 5 additions and 2 deletions

View File

@ -40,6 +40,7 @@ func m365Overrides(in map[string]string) map[string]string {
func configureAccount( func configureAccount(
vpr *viper.Viper, vpr *viper.Viper,
readConfigFromViper bool, readConfigFromViper bool,
matchFromConfig bool,
overrides map[string]string, overrides map[string]string,
) (account.Account, error) { ) (account.Account, error) {
var ( var (
@ -54,7 +55,9 @@ func configureAccount(
if err != nil { if err != nil {
return acct, clues.Wrap(err, "reading m365 configs from corso config file") return acct, clues.Wrap(err, "reading m365 configs from corso config file")
} }
}
if matchFromConfig {
if err := mustMatchConfig(vpr, m365Overrides(overrides)); err != nil { if err := mustMatchConfig(vpr, m365Overrides(overrides)); err != nil {
return acct, clues.Wrap(err, "verifying m365 configs in corso config file") return acct, clues.Wrap(err, "verifying m365 configs in corso config file")
} }

View File

@ -284,7 +284,7 @@ func getStorageAndAccountWithViper(
config.RepoID = vpr.GetString(RepoID) config.RepoID = vpr.GetString(RepoID)
} }
config.Account, err = configureAccount(vpr, readConfigFromViper, overrides) config.Account, err = configureAccount(vpr, readConfigFromViper, mustMatchFromConfig, overrides)
if err != nil { if err != nil {
return config, clues.Wrap(err, "retrieving account configuration details") return config, clues.Wrap(err, "retrieving account configuration details")
} }

View File

@ -270,7 +270,7 @@ func (suite *ConfigIntegrationSuite) TestGetStorageAndAccount() {
err = vpr.ReadInConfig() err = vpr.ReadInConfig()
require.NoError(t, err, "reading repo config", clues.ToCore(err)) require.NoError(t, err, "reading repo config", clues.ToCore(err))
config, err := getStorageAndAccountWithViper(vpr, true, false, nil) config, err := getStorageAndAccountWithViper(vpr, true, true, nil)
require.NoError(t, err, "getting storage and account from config", clues.ToCore(err)) require.NoError(t, err, "getting storage and account from config", clues.ToCore(err))
readS3Cfg, err := config.Storage.S3Config() readS3Cfg, err := config.Storage.S3Config()