MCPcopy Create free account
hub / github.com/docker/cli / TestValidatePorts

Function TestValidatePorts

cli/compose/schema/schema_test.go:32–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestValidatePorts(t *testing.T) {
33 testcases := []struct {
34 ports any
35 hasError bool
36 }{
37 {
38 ports: []int{8000},
39 hasError: false,
40 },
41 {
42 ports: []string{"8000:8000"},
43 hasError: false,
44 },
45 {
46 ports: []string{"8001-8005"},
47 hasError: false,
48 },
49 {
50 ports: []string{"8001-8005:8001-8005"},
51 hasError: false,
52 },
53 {
54 ports: []string{"8000"},
55 hasError: false,
56 },
57 {
58 ports: []string{"8000-9000:80"},
59 hasError: false,
60 },
61 {
62 ports: []string{"[::1]:8080:8000"},
63 hasError: false,
64 },
65 {
66 ports: []string{"[::1]:8080-8085:8000"},
67 hasError: false,
68 },
69 {
70 ports: []string{"127.0.0.1:8000:8000"},
71 hasError: false,
72 },
73 {
74 ports: []string{"127.0.0.1:8000-8005:8000-8005"},
75 hasError: false,
76 },
77 {
78 ports: []string{"127.0.0.1:8000:8000/udp"},
79 hasError: false,
80 },
81 {
82 ports: []string{"8000:8000/udp"},
83 hasError: false,
84 },
85 {
86 ports: []string{"8000:8000/http"},
87 hasError: true,
88 },
89 {

Callers

nothing calls this directly

Calls 2

ValidateFunction · 0.85
SprintMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…