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

Function Test_dockerFilePath

pkg/compose/build_test.go:27–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func Test_dockerFilePath(t *testing.T) {
28 tests := []struct {
29 name string
30 ctxName string
31 dockerfile string
32 expected string
33 }{
34 {
35 name: "empty dockerfile",
36 ctxName: "/some/local/dir",
37 dockerfile: "",
38 expected: "",
39 },
40 {
41 name: "local dir with relative dockerfile",
42 ctxName: "/some/local/dir",
43 dockerfile: "Dockerfile",
44 expected: "/some/local/dir/Dockerfile",
45 },
46 {
47 name: "local dir with absolute dockerfile",
48 ctxName: "/some/local/dir",
49 dockerfile: "/absolute/path/Dockerfile",
50 expected: "/absolute/path/Dockerfile",
51 },
52 {
53 name: "ssh URL preserves double slash",
54 ctxName: "ssh://git@github.com:22/docker/welcome-to-docker.git",
55 dockerfile: "Dockerfile",
56 expected: "Dockerfile",
57 },
58 {
59 name: "git:// URL returns dockerfile as-is",
60 ctxName: "git://github.com/docker/compose.git",
61 dockerfile: "Dockerfile",
62 expected: "Dockerfile",
63 },
64 {
65 name: "https git URL returns dockerfile as-is",
66 ctxName: "https://github.com/docker/compose.git",
67 dockerfile: "Dockerfile",
68 expected: "Dockerfile",
69 },
70 }
71 for _, tt := range tests {
72 t.Run(tt.name, func(t *testing.T) {
73 result := dockerFilePath(tt.ctxName, tt.dockerfile)
74 assert.Equal(t, tt.expected, result)
75 })
76 }
77}
78
79func Test_addBuildDependencies(t *testing.T) {
80 project := &types.Project{Services: types.Services{

Callers

nothing calls this directly

Calls 1

dockerFilePathFunction · 0.85

Tested by

no test coverage detected