MCPcopy
hub / github.com/docker/compose / TestContainerName

Function TestContainerName

pkg/compose/convergence_test.go:39–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37)
38
39func TestContainerName(t *testing.T) {
40 s := types.ServiceConfig{
41 Name: "testservicename",
42 ContainerName: "testcontainername",
43 Scale: intPtr(1),
44 Deploy: &types.DeployConfig{},
45 }
46 ret, err := getScale(s)
47 assert.NilError(t, err)
48 assert.Equal(t, ret, *s.Scale)
49
50 s.Scale = intPtr(0)
51 ret, err = getScale(s)
52 assert.NilError(t, err)
53 assert.Equal(t, ret, *s.Scale)
54
55 s.Scale = intPtr(2)
56 _, err = getScale(s)
57 assert.Error(t, err, fmt.Sprintf(doubledContainerNameWarning, s.Name, s.ContainerName))
58}
59
60func intPtr(i int) *int {
61 return &i

Callers

nothing calls this directly

Calls 3

intPtrFunction · 0.85
getScaleFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected