MCPcopy Create free account
hub / github.com/docker/compose / TestApplyPullOptions

Function TestApplyPullOptions

cmd/compose/pullOptions_test.go:26–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestApplyPullOptions(t *testing.T) {
27 project := &types.Project{
28 Services: types.Services{
29 "must-build": {
30 Name: "must-build",
31 // No image, local build only
32 Build: &types.BuildConfig{
33 Context: ".",
34 },
35 },
36 "has-build": {
37 Name: "has-build",
38 Image: "registry.example.com/myservice",
39 Build: &types.BuildConfig{
40 Context: ".",
41 },
42 },
43 "must-pull": {
44 Name: "must-pull",
45 Image: "registry.example.com/another-service",
46 },
47 },
48 }
49 project, err := pullOptions{
50 policy: types.PullPolicyMissing,
51 }.apply(project, nil)
52 assert.NilError(t, err)
53
54 assert.Equal(t, project.Services["must-build"].PullPolicy, "") // still default
55 assert.Equal(t, project.Services["has-build"].PullPolicy, types.PullPolicyMissing)
56 assert.Equal(t, project.Services["must-pull"].PullPolicy, types.PullPolicyMissing)
57}

Callers

nothing calls this directly

Calls 1

applyMethod · 0.45

Tested by

no test coverage detected