Skip to content

Commit

Permalink
Bypass FQDN resolution in darwin tests (#1296)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kruse <[email protected]>
  • Loading branch information
c-kruse authored Oct 23, 2023
1 parent e3f4a4a commit 6e31f8c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/extension/sumologicextension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,10 +986,13 @@ func addClientCredentials(req *http.Request, credentials accessCredentials) {
req.Header.Add("Authorization", authHeaderValue)
}

// TODO(ck): hostname allows the darwin tests to bypass fqdn.
var hostname = fqdn.FqdnHostname

// getHostname returns the host name consistently with the resource detection processor's defaults
// TODO: try to dynamically extract this from the resource processor in the pipeline
func getHostname(logger *zap.Logger) (string, error) {
fqdnHostname, err := fqdn.FqdnHostname()
fqdnHostname, err := hostname()
if err == nil {
return fqdnHostname, nil
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/extension/sumologicextension/extension_darwin_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package sumologicextension

import "os"

func init() {
// fqdn seems to hang running in github actions on darwin amd64. This
// bypasses it.
// https://github.com/SumoLogic/sumologic-otel-collector/issues/1295
hostname = os.Hostname
}

0 comments on commit 6e31f8c

Please sign in to comment.