MCPcopy Index your code
hub / github.com/docker/docker-agent / newURLSourceForTest

Function newURLSourceForTest

pkg/config/sources_test.go:33–39  ·  view source on GitHub ↗

newURLSourceForTest constructs a urlSource that bypasses the HTTPS-only and SSRF dial-time checks. It is defined here, in a _test.go file, so it is not compiled into release binaries. Tests use it because httptest.NewServer binds to 127.0.0.1 over plain HTTP.

(rawURL string, envProvider environment.Provider)

Source from the content-addressed store, hash-verified

31// not compiled into release binaries. Tests use it because httptest.NewServer
32// binds to 127.0.0.1 over plain HTTP.
33func newURLSourceForTest(rawURL string, envProvider environment.Provider) Source {
34 return &urlSource{
35 url: rawURL,
36 envProvider: envProvider,
37 unsafe: true,
38 }
39}
40
41func TestOCISource_DigestReference_ServesFromCache(t *testing.T) {
42 t.Parallel()

Calls

no outgoing calls

Tested by

no test coverage detected