Skip to content

Commit

Permalink
either read embedded configs or read them from FS, never both
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Jun 11, 2024
1 parent 1728e0a commit 23022f1
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions integration-tests/testconfig/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,29 +297,29 @@ func GetConfig(configurationName string, product Product) (TestConfig, error) {
return TestConfig{}, errors.Wrapf(err, "error unmarshalling embedded config")
}
}
}

logger.Info().Msg("Reading configs from file system")
for _, fileName := range fileNames {
logger.Debug().Msgf("Looking for config file %s", fileName)
filePath, err := osutil.FindFile(fileName, osutil.DEFAULT_STOP_FILE_NAME, 3)
} else {
logger.Info().Msg("Reading configs from file system")
for _, fileName := range fileNames {
logger.Debug().Msgf("Looking for config file %s", fileName)
filePath, err := osutil.FindFile(fileName, osutil.DEFAULT_STOP_FILE_NAME, 3)

if err != nil && errors.Is(err, os.ErrNotExist) {
logger.Debug().Msgf("Config file %s not found", fileName)
continue
} else if err != nil {
return TestConfig{}, errors.Wrapf(err, "error looking for file %s", filePath)
}
logger.Debug().Str("location", filePath).Msgf("Found config file %s", fileName)
if err != nil && errors.Is(err, os.ErrNotExist) {
logger.Debug().Msgf("Config file %s not found", fileName)
continue
} else if err != nil {
return TestConfig{}, errors.Wrapf(err, "error looking for file %s", filePath)
}
logger.Debug().Str("location", filePath).Msgf("Found config file %s", fileName)

content, err := readFile(filePath)
if err != nil {
return TestConfig{}, errors.Wrapf(err, "error reading file %s", filePath)
}
content, err := readFile(filePath)
if err != nil {
return TestConfig{}, errors.Wrapf(err, "error reading file %s", filePath)
}

err = ctf_config.BytesToAnyTomlStruct(logger, fileName, configurationName, &testConfig, content)
if err != nil {
return TestConfig{}, errors.Wrapf(err, "error reading file %s", filePath)
err = ctf_config.BytesToAnyTomlStruct(logger, fileName, configurationName, &testConfig, content)
if err != nil {
return TestConfig{}, errors.Wrapf(err, "error reading file %s", filePath)
}
}
}

Expand Down

0 comments on commit 23022f1

Please sign in to comment.