(t *testing.T)
| 34 | ) |
| 35 | |
| 36 | func TestApplyPlatforms_InferFromRuntime(t *testing.T) { |
| 37 | makeProject := func() *types.Project { |
| 38 | return &types.Project{ |
| 39 | Services: types.Services{ |
| 40 | "test": { |
| 41 | Name: "test", |
| 42 | Image: "foo", |
| 43 | Build: &types.BuildConfig{ |
| 44 | Context: ".", |
| 45 | Platforms: []string{ |
| 46 | "linux/amd64", |
| 47 | "linux/arm64", |
| 48 | "alice/32", |
| 49 | }, |
| 50 | }, |
| 51 | Platform: "alice/32", |
| 52 | }, |
| 53 | }, |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | t.Run("SinglePlatform", func(t *testing.T) { |
| 58 | project := makeProject() |
| 59 | assert.NilError(t, applyPlatforms(project, true)) |
| 60 | assert.DeepEqual(t, types.StringList{"alice/32"}, project.Services["test"].Build.Platforms) |
| 61 | }) |
| 62 | |
| 63 | t.Run("MultiPlatform", func(t *testing.T) { |
| 64 | project := makeProject() |
| 65 | assert.NilError(t, applyPlatforms(project, false)) |
| 66 | assert.DeepEqual(t, types.StringList{"linux/amd64", "linux/arm64", "alice/32"}, project.Services["test"].Build.Platforms) |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | func TestApplyPlatforms_DockerDefaultPlatform(t *testing.T) { |
| 71 | makeProject := func() *types.Project { |
nothing calls this directly
no test coverage detected