Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/engine/daemon/logger/splunk/splunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func New(info logger.Info) (logger.Logger, error) {

transport := &http.Transport{
TLSClientConfig: tlsConfig,
Proxy: http.ProxyFromEnvironment,
}
client := &http.Client{
Transport: transport,
Expand Down
32 changes: 32 additions & 0 deletions components/engine/daemon/logger/splunk/splunk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"compress/gzip"
"context"
"fmt"
"net/http"
"os"
"runtime"
"testing"
"time"

"github.com/docker/docker/daemon/logger"
"github.com/gotestyourself/gotestyourself/env"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -82,6 +84,36 @@ func TestNewMissedToken(t *testing.T) {
}
}

func TestNewWithProxy(t *testing.T) {
proxy := "http://proxy.testing:8888"
reset := env.Patch(t, "HTTP_PROXY", proxy)
defer reset()

// must not be localhost
splunkURL := "http://example.com:12345"
logger, err := New(logger.Info{
Config: map[string]string{
splunkURLKey: splunkURL,
splunkTokenKey: "token",
splunkVerifyConnectionKey: "false",
},
ContainerID: "containeriid",
})
require.NoError(t, err)
splunkLogger := logger.(*splunkLoggerInline)

proxyFunc := splunkLogger.transport.Proxy
require.NotNil(t, proxyFunc)

req, err := http.NewRequest("GET", splunkURL, nil)
require.NoError(t, err)

proxyURL, err := proxyFunc(req)
require.NoError(t, err)
require.NotNil(t, proxyURL)
require.Equal(t, proxy, proxyURL.String())
}

// Test default settings
func TestDefault(t *testing.T) {
hec := NewHTTPEventCollectorMock(t)
Expand Down
3 changes: 2 additions & 1 deletion components/engine/vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ github.com/docker/go-connections 3ede32e2033de7505e6500d6c868c2b9ed9f169d
golang.org/x/text f72d8390a633d5dfb0cc84043294db9f6c935756
github.com/stretchr/testify 4d4bfba8f1d1027c4fdbe371823030df51419987
github.com/pmezard/go-difflib v1.0.0
github.com/gotestyourself/gotestyourself v1.1.0
github.com/gotestyourself/gotestyourself 511344eed30e4384f010579a593dfb442033a692
github.com/google/go-cmp v0.1.0

github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5
github.com/imdario/mergo 0.2.1
Expand Down
27 changes: 27 additions & 0 deletions components/engine/vendor/github.com/google/go-cmp/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions components/engine/vendor/github.com/google/go-cmp/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading