(t *testing.T)
| 37 | ) |
| 38 | |
| 39 | func Test_createLayers(t *testing.T) { |
| 40 | project, err := loader.LoadWithContext(t.Context(), types.ConfigDetails{ |
| 41 | WorkingDir: "testdata/publish/", |
| 42 | Environment: types.Mapping{}, |
| 43 | ConfigFiles: []types.ConfigFile{ |
| 44 | { |
| 45 | Filename: "testdata/publish/compose.yaml", |
| 46 | }, |
| 47 | }, |
| 48 | }) |
| 49 | assert.NilError(t, err) |
| 50 | project.ComposeFiles = []string{"testdata/publish/compose.yaml"} |
| 51 | |
| 52 | service := &composeService{} |
| 53 | layers, err := service.createLayers(t.Context(), project, api.PublishOptions{ |
| 54 | WithEnvironment: true, |
| 55 | }) |
| 56 | assert.NilError(t, err) |
| 57 | |
| 58 | published := string(layers[0].Data) |
| 59 | assert.Equal(t, published, `name: test |
| 60 | services: |
| 61 | test: |
| 62 | extends: |
| 63 | file: f8f9ede3d201ec37d5a5e3a77bbadab79af26035e53135e19571f50d541d390c.yaml |
| 64 | service: foo |
| 65 | |
| 66 | string: |
| 67 | image: test |
| 68 | env_file: 5efca9cdbac9f5394c6c2e2094b1b42661f988f57fcab165a0bf72b205451af3.env |
| 69 | |
| 70 | list: |
| 71 | image: test |
| 72 | env_file: |
| 73 | - 5efca9cdbac9f5394c6c2e2094b1b42661f988f57fcab165a0bf72b205451af3.env |
| 74 | |
| 75 | mapping: |
| 76 | image: test |
| 77 | env_file: |
| 78 | - path: 5efca9cdbac9f5394c6c2e2094b1b42661f988f57fcab165a0bf72b205451af3.env |
| 79 | `) |
| 80 | |
| 81 | expectedLayers := []v1.Descriptor{ |
| 82 | { |
| 83 | MediaType: "application/vnd.docker.compose.file+yaml", |
| 84 | Annotations: map[string]string{ |
| 85 | "com.docker.compose.file": "compose.yaml", |
| 86 | "com.docker.compose.version": internal.Version, |
| 87 | }, |
| 88 | }, |
| 89 | { |
| 90 | MediaType: "application/vnd.docker.compose.file+yaml", |
| 91 | Annotations: map[string]string{ |
| 92 | "com.docker.compose.extends": "true", |
| 93 | "com.docker.compose.file": "f8f9ede3d201ec37d5a5e3a77bbadab79af26035e53135e19571f50d541d390c", |
| 94 | "com.docker.compose.version": internal.Version, |
| 95 | }, |
| 96 | }, |
nothing calls this directly
no test coverage detected