|
1 | 1 | package e2e |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "bytes" |
5 | 4 | "encoding/json" |
6 | 5 | "fmt" |
7 | 6 | "io/ioutil" |
8 | | - "path" |
9 | 7 | "path/filepath" |
10 | 8 | "regexp" |
11 | 9 | "strings" |
@@ -130,27 +128,6 @@ maintainers: |
130 | 128 | cmd.Command = dockerCli.Command("app", "validate", testAppName) |
131 | 129 | stdOut = icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined() |
132 | 130 | golden.Assert(t, stdOut, "validate-output.golden") |
133 | | - |
134 | | - // test single-file init |
135 | | - cmd.Command = dockerCli.Command("app", |
136 | | - "init", "myapp", |
137 | | - "--compose-file", tmpDir.Join(internal.ComposeFileName), |
138 | | - "--description", "some description", |
139 | | - "--maintainer", "dev1", |
140 | | - "--maintainer", "dev2:dev2@example.com", |
141 | | - "--single-file", |
142 | | - ) |
143 | | - icmd.RunCmd(cmd).Assert(t, icmd.Success) |
144 | | - |
145 | | - appData, err := ioutil.ReadFile(tmpDir.Join("myapp.dockerapp")) |
146 | | - assert.NilError(t, err) |
147 | | - golden.Assert(t, string(appData), "init-singlefile.dockerapp") |
148 | | - // Check various commands work on single-file app package |
149 | | - cmd.Command = dockerCli.Command("app", "inspect", "myapp") |
150 | | - icmd.RunCmd(cmd).Assert(t, icmd.Success) |
151 | | - |
152 | | - cmd.Command = dockerCli.Command("app", "render", "myapp") |
153 | | - icmd.RunCmd(cmd).Assert(t, icmd.Success) |
154 | 131 | } |
155 | 132 |
|
156 | 133 | func TestDetectApp(t *testing.T) { |
@@ -187,82 +164,6 @@ func TestDetectApp(t *testing.T) { |
187 | 164 | }) |
188 | 165 | } |
189 | 166 |
|
190 | | -func patchEndOfLine(t *testing.T, eol []byte, name, fromDir, toDir string) { |
191 | | - buf := golden.Get(t, filepath.Join(fromDir, name)) |
192 | | - bytes.ReplaceAll(buf, []byte{'\n'}, eol) |
193 | | - assert.NilError(t, ioutil.WriteFile(filepath.Join(toDir, name), buf, 0644)) |
194 | | -} |
195 | | - |
196 | | -func TestSplitMerge(t *testing.T) { |
197 | | - testCases := []struct { |
198 | | - name string |
199 | | - lineEnding []byte |
200 | | - }{ |
201 | | - { |
202 | | - name: "without-crlf", |
203 | | - lineEnding: []byte{'\n'}, |
204 | | - }, |
205 | | - { |
206 | | - name: "with-crlf", |
207 | | - lineEnding: []byte{'\r', '\n'}, |
208 | | - }, |
209 | | - } |
210 | | - for _, test := range testCases { |
211 | | - t.Run(test.name, func(t *testing.T) { |
212 | | - cmd, cleanup := dockerCli.createTestCmd() |
213 | | - defer cleanup() |
214 | | - |
215 | | - tmpDir := fs.NewDir(t, "split_merge", fs.WithDir("my.dockerapp")) |
216 | | - defer tmpDir.Remove() |
217 | | - |
218 | | - inputDir := filepath.Join("render", "envvariables", "my.dockerapp") |
219 | | - testDataDir := tmpDir.Join("my.dockerapp") |
220 | | - |
221 | | - // replace the line ending from the versioned test data files and put them to a temp dir |
222 | | - for _, name := range internal.FileNames { |
223 | | - patchEndOfLine(t, test.lineEnding, name, inputDir, testDataDir) |
224 | | - } |
225 | | - |
226 | | - // Merge a multi-files app to a single-file app |
227 | | - cmd.Command = dockerCli.Command("app", "merge", testDataDir, "--output", tmpDir.Join("remerged.dockerapp")) |
228 | | - icmd.RunCmd(cmd).Assert(t, icmd.Success) |
229 | | - |
230 | | - cmd.Dir = tmpDir.Path() |
231 | | - |
232 | | - // test that inspect works on single-file |
233 | | - cmd.Command = dockerCli.Command("app", "inspect", "remerged") |
234 | | - result := icmd.RunCmd(cmd).Assert(t, icmd.Success) |
235 | | - golden.Assert(t, result.Combined(), "envvariables-inspect.golden") |
236 | | - |
237 | | - // split it |
238 | | - cmd.Command = dockerCli.Command("app", "split", "remerged", "--output", "split.dockerapp") |
239 | | - icmd.RunCmd(cmd).Assert(t, icmd.Success) |
240 | | - |
241 | | - // test that inspect still works |
242 | | - cmd.Command = dockerCli.Command("app", "inspect", "remerged") |
243 | | - result = icmd.RunCmd(cmd).Assert(t, icmd.Success) |
244 | | - golden.Assert(t, result.Combined(), "envvariables-inspect.golden") |
245 | | - |
246 | | - // the split app must be the same as the original one |
247 | | - manifest := fs.Expected( |
248 | | - t, |
249 | | - fs.WithMode(0755), |
250 | | - fs.WithFile(internal.MetadataFileName, string(golden.Get(t, path.Join(testDataDir, internal.MetadataFileName))), fs.WithMode(0644)), |
251 | | - fs.WithFile(internal.ComposeFileName, string(golden.Get(t, path.Join(testDataDir, internal.ComposeFileName))), fs.WithMode(0644)), |
252 | | - fs.WithFile(internal.ParametersFileName, string(golden.Get(t, path.Join(testDataDir, internal.ParametersFileName))), fs.WithMode(0644)), |
253 | | - ) |
254 | | - assert.Assert(t, fs.Equal(tmpDir.Join("split.dockerapp"), manifest)) |
255 | | - |
256 | | - // test inplace |
257 | | - cmd.Command = dockerCli.Command("app", "merge", "split") |
258 | | - icmd.RunCmd(cmd).Assert(t, icmd.Success) |
259 | | - |
260 | | - cmd.Command = dockerCli.Command("app", "split", "split") |
261 | | - icmd.RunCmd(cmd).Assert(t, icmd.Success) |
262 | | - }) |
263 | | - } |
264 | | -} |
265 | | - |
266 | 167 | func TestBundle(t *testing.T) { |
267 | 168 | cmd, cleanup := dockerCli.createTestCmd() |
268 | 169 | defer cleanup() |
|
0 commit comments