Skip to content

Commit

Permalink
Updated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JoukoVirtanen committed Nov 14, 2024
1 parent 0855df2 commit 13d219f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions integration-tests/suites/runtime_config_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ func (s *RuntimeConfigFileTestSuite) setExternalIpsEnable(runtimeConfigFile stri
}

// Launches collector and creates the directory for runtime configuration.
// Writes various things to the file for runtime configuration and checks
// the config introspection endpoint to make sure that the configuration is
// correct.
func (s *RuntimeConfigFileTestSuite) SetupTest() {
s.RegisterCleanup("external-connection")

Expand Down Expand Up @@ -138,10 +135,10 @@ func (s *RuntimeConfigFileTestSuite) TestRuntimeConfigFileEnable() {
connectionSuccess = s.Sensor().ExpectSameElementsConnections(s.T(), s.ClientContainer, 10*time.Second, expectedConnections...)
s.Require().True(connectionSuccess)

s.deleteFile(runtimeConfigFile)
assert.AssertNoRuntimeConfig(s.T(), collectorIP)
// The runtime config file is deleted. This disables external IPs. The normalized connection should be active
// and the unnormalized connection shoul be inactive.
s.deleteFile(runtimeConfigFile)
assert.AssertNoRuntimeConfig(s.T(), collectorIP)
expectedConnections = append(expectedConnections, activeNormalizedConnection, inactiveUnnormalizedConnection)
connectionSuccess = s.Sensor().ExpectSameElementsConnections(s.T(), s.ClientContainer, 10*time.Second, expectedConnections...)
s.Require().True(connectionSuccess)
Expand All @@ -155,14 +152,16 @@ func (s *RuntimeConfigFileTestSuite) TestRuntimeConfigFileEnable() {
}

func (s *RuntimeConfigFileTestSuite) TestRuntimeConfigFileDisable() {
// The runtime config file was deleted before starting collector so there should not be any config
// The runtime config file was deleted before starting collector.
// Default configuration is external IPs disabled.
// We expect normalized connections.
assert.AssertNoRuntimeConfig(s.T(), collectorIP)
// Since there is no config the default is used, which means external IPs is disabled and we should
// expect a normalized connection
expectedConnections := []types.NetworkInfo{activeNormalizedConnection}
connectionSuccess := s.Sensor().ExpectSameElementsConnections(s.T(), s.ClientContainer, 10*time.Second, expectedConnections...)
s.Require().True(connectionSuccess)

// The runtime config file is created, but external IPs is disables.
// There is no change in the state, so there are no changes to the connections
s.setExternalIpsEnable(runtimeConfigFile, false)
assert.AssertExternalIps(s.T(), false, collectorIP)
common.Sleep(3 * time.Second) // Sleep so that collector has a chance to report connections
Expand All @@ -178,10 +177,10 @@ func (s *RuntimeConfigFileTestSuite) TestRuntimeConfigFileDisable() {
}

func (s *RuntimeConfigFileTestSuite) TestRuntimeConfigFileInvalid() {
// The runtime config file was deleted before starting collector so there should not be any config
// The runtime config file was deleted before starting collector.
// Default configuration is external IPs disabled.
// We expect normalized connections.
assert.AssertNoRuntimeConfig(s.T(), collectorIP)
// Since there is no config the default is used, which means external IPs is disabled and we should
// expect a normalized connection
expectedConnections := []types.NetworkInfo{activeNormalizedConnection}
connectionSuccess := s.Sensor().ExpectSameElementsConnections(s.T(), s.ClientContainer, 10*time.Second, expectedConnections...)
s.Require().True(connectionSuccess)
Expand Down

0 comments on commit 13d219f

Please sign in to comment.