MCPcopy Index your code
hub / github.com/containerd/containerd / TestHTTPFallbackResolver

Function TestHTTPFallbackResolver

core/remotes/docker/resolver_test.go:403–431  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

401}
402
403func TestHTTPFallbackResolver(t *testing.T) {
404 sf := func(h http.Handler) (string, ResolverOptions, func()) {
405 s := httptest.NewServer(h)
406 u, err := url.Parse(s.URL)
407 if err != nil {
408 t.Fatal(err)
409 }
410
411 client := &http.Client{
412 Transport: NewHTTPFallback(http.DefaultTransport),
413 }
414 options := ResolverOptions{
415 Hosts: func(host string) ([]RegistryHost, error) {
416 return []RegistryHost{
417 {
418 Client: client,
419 Host: u.Host,
420 Scheme: "https",
421 Path: "/v2",
422 Capabilities: HostCapabilityPull | HostCapabilityResolve | HostCapabilityPush,
423 },
424 }, nil
425 },
426 }
427 return u.Host, options, s.Close
428 }
429
430 runBasicTest(t, "testname", sf)
431}
432
433func TestHTTPFallbackTimeoutResolver(t *testing.T) {
434 sf := func(h http.Handler) (string, ResolverOptions, func()) {

Callers

nothing calls this directly

Calls 3

NewHTTPFallbackFunction · 0.85
FatalMethod · 0.80
runBasicTestFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…