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

Function TestIsRemoteConfig

cmd/compose/options_test.go:140–183  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

138}
139
140func TestIsRemoteConfig(t *testing.T) {
141 ctrl := gomock.NewController(t)
142 defer ctrl.Finish()
143 cli := mocks.NewMockCli(ctrl)
144
145 tests := []struct {
146 name string
147 configPaths []string
148 want bool
149 }{
150 {
151 name: "empty config paths",
152 configPaths: []string{},
153 want: false,
154 },
155 {
156 name: "local file",
157 configPaths: []string{"docker-compose.yaml"},
158 want: false,
159 },
160 {
161 name: "OCI reference",
162 configPaths: []string{"oci://registry.example.com/stack:latest"},
163 want: true,
164 },
165 {
166 name: "GIT reference",
167 configPaths: []string{"git://github.com/user/repo.git"},
168 want: true,
169 },
170 }
171
172 for _, tt := range tests {
173 t.Run(tt.name, func(t *testing.T) {
174 opts := buildOptions{
175 ProjectOptions: &ProjectOptions{
176 ConfigPaths: tt.configPaths,
177 },
178 }
179 got := isRemoteConfig(cli, opts)
180 assert.Equal(t, tt.want, got)
181 })
182 }
183}
184
185func TestDisplayLocationRemoteStack(t *testing.T) {
186 ctrl := gomock.NewController(t)

Callers

nothing calls this directly

Calls 2

NewMockCliFunction · 0.92
isRemoteConfigFunction · 0.85

Tested by

no test coverage detected