diff --git a/integration-tests/pkg/types/runtime_config.go b/integration-tests/pkg/types/runtime_config.go index 6ad85449c1..69b42ca591 100644 --- a/integration-tests/pkg/types/runtime_config.go +++ b/integration-tests/pkg/types/runtime_config.go @@ -3,9 +3,9 @@ package types type RuntimeConfig struct { Networking struct { ExternalIps struct { - Enable bool - } - } + Enable bool `yaml:"enable"` + } `yaml:"externalIps"` + } `yaml:"networking"` } func (n *RuntimeConfig) Equal(other RuntimeConfig) bool { diff --git a/integration-tests/suites/base.go b/integration-tests/suites/base.go index 1e41e48934..4f75aba725 100644 --- a/integration-tests/suites/base.go +++ b/integration-tests/suites/base.go @@ -458,6 +458,16 @@ func (s *IntegrationTestSuiteBase) execShellCommand(command string) error { return err } +func (s *IntegrationTestSuiteBase) createDirectory(dir string) { + cmd := "mkdir " + dir + s.execShellCommand(cmd) +} + +func (s *IntegrationTestSuiteBase) deleteFile(file string) { + cmd := "rm " + file + s.execShellCommand(cmd) +} + func (s *IntegrationTestSuiteBase) waitForFileToBeDeleted(file string) error { timer := time.After(10 * time.Second) ticker := time.NewTicker(time.Second) diff --git a/integration-tests/suites/runtime_config_file.go b/integration-tests/suites/runtime_config_file.go index 940d727207..65afe0955c 100644 --- a/integration-tests/suites/runtime_config_file.go +++ b/integration-tests/suites/runtime_config_file.go @@ -2,8 +2,8 @@ package suites import ( "fmt" + "gopkg.in/yaml.v3" "path/filepath" - "strconv" "time" "github.com/stackrox/collector/integration-tests/pkg/assert" @@ -61,25 +61,19 @@ type RuntimeConfigFileTestSuite struct { ClientContainer string } -func (s *RuntimeConfigFileTestSuite) createDirectory(dir string) { - cmd := "mkdir " + dir - s.execShellCommand(cmd) -} - -func (s *RuntimeConfigFileTestSuite) deleteFile(file string) { - cmd := "rm " + file - s.execShellCommand(cmd) -} - func (s *RuntimeConfigFileTestSuite) setRuntimeConfig(runtimeConfigFile string, configStr string) { cmd := "echo '" + configStr + "' > " + runtimeConfigFile s.execShellCommand(cmd) } func (s *RuntimeConfigFileTestSuite) setExternalIpsEnable(runtimeConfigFile string, enable bool) { - configStr := `networking: - externalIps: - enable: ` + strconv.FormatBool(enable) + var runtimeConfig types.RuntimeConfig + runtimeConfig.Networking.ExternalIps.Enable = enable + + yamlBytes, err := yaml.Marshal(runtimeConfig) + s.Require().NoError(err) + + configStr := string(yamlBytes) s.setRuntimeConfig(runtimeConfigFile, configStr) }