MCPcopy Create free account
hub / github.com/containerd/containerd / TestHTTPFallbackPortError

Function TestHTTPFallbackPortError

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

Source from the content-addressed store, hash-verified

484}
485
486func TestHTTPFallbackPortError(t *testing.T) {
487 // This test only checks the isPortError since testing the whole http fallback would
488 // require listening on 80 and making sure nothing is listening on 443.
489
490 l, err := net.Listen("tcp", "127.0.0.1:0")
491 if err != nil {
492 t.Fatal(err)
493 }
494 host := l.Addr().String()
495 err = l.Close()
496 if err != nil {
497 t.Fatal(err)
498 }
499
500 _, err = net.Dial("tcp", host)
501 if err == nil {
502 t.Fatal("Dial should fail after close")
503 }
504
505 if isPortError(err, host) {
506 t.Fatalf("Expected no port error for %s with %v", host, err)
507 }
508 if !isPortError(err, "127.0.0.1") {
509 t.Fatalf("Expected port error for 127.0.0.1 with %v", err)
510 }
511
512}
513
514func TestResolveProxy(t *testing.T) {
515 var (

Callers

nothing calls this directly

Calls 4

isPortErrorFunction · 0.85
FatalMethod · 0.80
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…