From 23022f18e92e2cacad8113cf4571e6cddf9a1783 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 11 Jun 2024 18:09:24 +0200 Subject: [PATCH] either read embedded configs or read them from FS, never both --- integration-tests/testconfig/testconfig.go | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/integration-tests/testconfig/testconfig.go b/integration-tests/testconfig/testconfig.go index aeddcd1733d..624c374491b 100644 --- a/integration-tests/testconfig/testconfig.go +++ b/integration-tests/testconfig/testconfig.go @@ -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) + } } }