Skip to content

Commit

Permalink
rename setConnectionType to determineConnectionType
Browse files Browse the repository at this point in the history
  • Loading branch information
AtzeDeVries committed Nov 14, 2024
1 parent 0867052 commit d043915
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions boostrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ func TestSetConnectionType(t *testing.T) {
}

// If not auto it should just pass through
connectionType, err := setConnectionType(ddCfg, ConnectionTypeSocket)
connectionType, err := determineConnectionType(ddCfg, ConnectionTypeSocket)
assert.NoError(t, err)
assert.Equal(t, ConnectionTypeSocket, connectionType)

// Auto should detect
connectionType, err = setConnectionType(ddCfg, ConnectionTypeAuto)
connectionType, err = determineConnectionType(ddCfg, ConnectionTypeAuto)
assert.NoError(t, err)
assert.Equal(t, ConnectionTypeHTTP, connectionType)

// Fail on unable to detect when auto
ddCfg.APM = "tmp"
connectionType, err = setConnectionType(ddCfg, ConnectionTypeAuto)
connectionType, err = determineConnectionType(ddCfg, ConnectionTypeAuto)
assert.Error(t, err)
assert.Equal(t, ConnectionTypeAuto, connectionType)
}
4 changes: 2 additions & 2 deletions bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func StartDatadog(cfg config.DatadogParameters, connectionType ConnectionType) e

compareConfigWithEnv(cfg)

connectionType, err = setConnectionType(cfg, connectionType)
connectionType, err = determineConnectionType(cfg, connectionType)
if err != nil {
return err
}
Expand Down Expand Up @@ -106,7 +106,7 @@ func GracefulDatadogShutdown() {
defer profiler.Stop()
}

func setConnectionType(cfg config.DatadogParameters, connectionType ConnectionType) (ConnectionType, error) {
func determineConnectionType(cfg config.DatadogParameters, connectionType ConnectionType) (ConnectionType, error) {
switch connectionType {
case ConnectionTypeSocket:
return connectionType, nil
Expand Down

0 comments on commit d043915

Please sign in to comment.