MCPcopy Create free account
hub / github.com/efficientgo/e2e / TestGetDockerPortMapping

Function TestGetDockerPortMapping

env_docker_test.go:13–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestGetDockerPortMapping(t *testing.T) {
14 for _, tcase := range []struct {
15 out string
16 expectedPort int
17 expectedErr error
18 }{
19 {out: "0.0.0.0:2313", expectedPort: 2313},
20 {out: "error", expectedErr: errors.New("got unexpected output: error")},
21 {out: ` 0.0.0.0:49154
22 :::49154`, expectedPort: 49154},
23 } {
24 t.Run("", func(t *testing.T) {
25 l, err := getDockerPortMapping([]byte(tcase.out))
26 if tcase.expectedErr != nil {
27 testutil.NotOk(t, err)
28 testutil.Equals(t, tcase.expectedErr.Error(), err.Error())
29 return
30 }
31 testutil.Ok(t, err)
32 testutil.Equals(t, tcase.expectedPort, l)
33 })
34 }
35}
36
37func TestValidateName(t *testing.T) {
38 for _, tcase := range []struct {

Callers

nothing calls this directly

Calls 1

getDockerPortMappingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…