diff --git a/integration-tests/suites/base.go b/integration-tests/suites/base.go index b61c3212d0..32e5afa1ac 100644 --- a/integration-tests/suites/base.go +++ b/integration-tests/suites/base.go @@ -466,6 +466,16 @@ func (s *IntegrationTestSuiteBase) createDirectory(dir string) { s.Require().NoError(err) } +func (s *IntegrationTestSuiteBase) deleteDirectory(dir string) { + _, err := os.Stat(dir) + if os.IsNotExist(err) { + return + } + + err = os.RemoveAll(dir) + s.Require().NoError(err) +} + func (s *IntegrationTestSuiteBase) deleteFile(file string) { if _, err := os.Stat(file); os.IsNotExist(err) { return diff --git a/integration-tests/suites/runtime_config_file.go b/integration-tests/suites/runtime_config_file.go index 525e1de2d1..e5bd252849 100644 --- a/integration-tests/suites/runtime_config_file.go +++ b/integration-tests/suites/runtime_config_file.go @@ -104,17 +104,20 @@ func (s *RuntimeConfigFileTestSuite) SetupTest() { } s.createDirectory(runtimeConfigDir) - s.deleteFile(runtimeConfigFile) s.StartCollector(false, &collectorOptions) } -func (s *RuntimeConfigFileTestSuite) AfterTest() { +func (s *RuntimeConfigFileTestSuite) AfterTest(suiteName, testName string) { s.StopCollector() s.cleanupContainers("external-connection") s.WritePerfResults() s.deleteFile(runtimeConfigFile) } +func (s *RuntimeConfigFileTestSuite) TearDownSuite() { + s.deleteDirectory(runtimeConfigDir) +} + func (s *RuntimeConfigFileTestSuite) TestRuntimeConfigFileEnable() { // The runtime config file was deleted before starting collector. // Default configuration is external IPs disabled.