From 37d87f208de37632b4d11ca5250e26c16e220205 Mon Sep 17 00:00:00 2001 From: Micah Young Date: Wed, 14 Oct 2020 06:35:54 -0400 Subject: [PATCH] Removes skips for windows package tests Signed-off-by: Micah Young --- acceptance/acceptance_test.go | 158 ++++++++---------- .../buildpacks/package_image_buildpack.go | 1 - .../pack_fixtures/builder-windows.toml | 40 ----- 3 files changed, 70 insertions(+), 129 deletions(-) delete mode 100644 acceptance/testdata/pack_fixtures/builder-windows.toml diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index b088a46de0..c9e2c4d690 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -544,6 +544,7 @@ func testWithoutSpecificBuilderRequirement( buildpacks.FolderSimpleLayersParent, buildpacks.FolderSimpleLayers, ), + buildpacks.WithOS(dockerHostOS()), ) buildpackManager.PrepareBuildpacks(tmpDir, packageFile) @@ -564,10 +565,6 @@ func testWithoutSpecificBuilderRequirement( }) when("buildpack image", func() { - it.Before(func() { - h.SkipIf(t, dockerHostOS() == "windows", "These tests are not yet compatible with Windows-based containers") - }) - when("inspect-buildpack", func() { it("succeeds", func() { packageImageName := registryConfig.RepoName("buildpack-" + h.RandString(8)) @@ -2126,70 +2123,68 @@ func createComplexBuilder(t *testing.T, "run_image_mirror": runImageMirror, } - if dockerHostOS() != "windows" { - packageImageName := registryConfig.RepoName("nested-level-1-buildpack-" + h.RandString(8)) - nestedLevelTwoBuildpackName := registryConfig.RepoName("nested-level-2-buildpack-" + h.RandString(8)) - simpleLayersBuildpackName := registryConfig.RepoName("simple-layers-buildpack-" + h.RandString(8)) - - templateMapping["package_id"] = "simple/nested-level-1" - templateMapping["package_image_name"] = packageImageName - templateMapping["nested_level_1_buildpack"] = packageImageName - templateMapping["nested_level_2_buildpack"] = nestedLevelTwoBuildpackName - templateMapping["simple_layers_buildpack"] = simpleLayersBuildpackName - - fixtureManager := pack.FixtureManager() - - nestedLevelOneConfigFile, err := ioutil.TempFile(tmpDir, "nested-level-1-package.toml") - assert.Nil(err) - fixtureManager.TemplateFixtureToFile( - "nested-level-1-buildpack_package.toml", - nestedLevelOneConfigFile, - templateMapping, - ) - err = nestedLevelOneConfigFile.Close() - assert.Nil(err) - - nestedLevelTwoConfigFile, err := ioutil.TempFile(tmpDir, "nested-level-2-package.toml") - assert.Nil(err) - fixtureManager.TemplateFixtureToFile( - "nested-level-2-buildpack_package.toml", - nestedLevelTwoConfigFile, - templateMapping, - ) - err = nestedLevelTwoConfigFile.Close() - assert.Nil(err) + packageImageName := registryConfig.RepoName("nested-level-1-buildpack-" + h.RandString(8)) + nestedLevelTwoBuildpackName := registryConfig.RepoName("nested-level-2-buildpack-" + h.RandString(8)) + simpleLayersBuildpackName := registryConfig.RepoName("simple-layers-buildpack-" + h.RandString(8)) - packageImageBuildpack := buildpacks.NewPackageImage( - t, - pack, - packageImageName, - nestedLevelOneConfigFile.Name(), - buildpacks.WithRequiredBuildpacks( - buildpacks.NestedLevelOne, - buildpacks.NewPackageImage( - t, - pack, - nestedLevelTwoBuildpackName, - nestedLevelTwoConfigFile.Name(), - buildpacks.WithRequiredBuildpacks( - buildpacks.NestedLevelTwo, - buildpacks.NewPackageImage( - t, - pack, - simpleLayersBuildpackName, - fixtureManager.FixtureLocation("simple-layers-buildpack_package.toml"), - buildpacks.WithRequiredBuildpacks(buildpacks.SimpleLayers), - ), + templateMapping["package_id"] = "simple/nested-level-1" + templateMapping["package_image_name"] = packageImageName + templateMapping["nested_level_1_buildpack"] = packageImageName + templateMapping["nested_level_2_buildpack"] = nestedLevelTwoBuildpackName + templateMapping["simple_layers_buildpack"] = simpleLayersBuildpackName + + fixtureManager := pack.FixtureManager() + + nestedLevelOneConfigFile, err := ioutil.TempFile(tmpDir, "nested-level-1-package.toml") + assert.Nil(err) + fixtureManager.TemplateFixtureToFile( + "nested-level-1-buildpack_package.toml", + nestedLevelOneConfigFile, + templateMapping, + ) + err = nestedLevelOneConfigFile.Close() + assert.Nil(err) + + nestedLevelTwoConfigFile, err := ioutil.TempFile(tmpDir, "nested-level-2-package.toml") + assert.Nil(err) + fixtureManager.TemplateFixtureToFile( + "nested-level-2-buildpack_package.toml", + nestedLevelTwoConfigFile, + templateMapping, + ) + err = nestedLevelTwoConfigFile.Close() + assert.Nil(err) + + packageImageBuildpack := buildpacks.NewPackageImage( + t, + pack, + packageImageName, + nestedLevelOneConfigFile.Name(), + buildpacks.WithRequiredBuildpacks( + buildpacks.NestedLevelOne, + buildpacks.NewPackageImage( + t, + pack, + nestedLevelTwoBuildpackName, + nestedLevelTwoConfigFile.Name(), + buildpacks.WithRequiredBuildpacks( + buildpacks.NestedLevelTwo, + buildpacks.NewPackageImage( + t, + pack, + simpleLayersBuildpackName, + fixtureManager.FixtureLocation("simple-layers-buildpack_package.toml"), + buildpacks.WithRequiredBuildpacks(buildpacks.SimpleLayers), ), ), ), - ) + ), + ) - builderBuildpacks = append( - builderBuildpacks, - packageImageBuildpack, - ) - } + builderBuildpacks = append( + builderBuildpacks, + packageImageBuildpack, + ) buildpackManager.PrepareBuildpacks(tmpDir, builderBuildpacks...) @@ -2260,30 +2255,22 @@ func createBuilder( buildpacks.ReadEnv, } - // NOTE: Windows-based packages are not yet supported, so we'll add this buildpack in the usual way for now. - // Remove this block once Windows-based packages are supported. - if dockerHostOS() == "windows" { - builderBuildpacks = append(builderBuildpacks, buildpacks.SimpleLayers) - } + builderBuildpacks = append(builderBuildpacks, buildpacks.SimpleLayers) - // NOTE: Windows-based packages are not yet supported, so we'll add this buildpack in the usual way for now (see above). - // Remove this guard once Windows-based packages are supported. - if dockerHostOS() != "windows" { - packageImageName := registryConfig.RepoName("simple-layers-package-image-buildpack-" + h.RandString(8)) + packageImageName := registryConfig.RepoName("simple-layers-package-image-buildpack-" + h.RandString(8)) - packageImageBuildpack := buildpacks.NewPackageImage( - t, - pack, - packageImageName, - pack.FixtureManager().FixtureLocation("package.toml"), - buildpacks.WithRequiredBuildpacks(buildpacks.SimpleLayers), - ) + packageImageBuildpack := buildpacks.NewPackageImage( + t, + pack, + packageImageName, + pack.FixtureManager().FixtureLocation("package.toml"), + buildpacks.WithRequiredBuildpacks(buildpacks.SimpleLayers), + ) - builderBuildpacks = append(builderBuildpacks, packageImageBuildpack) + builderBuildpacks = append(builderBuildpacks, packageImageBuildpack) - templateMapping["package_image_name"] = packageImageName - templateMapping["package_id"] = "simple/layers" - } + templateMapping["package_image_name"] = packageImageName + templateMapping["package_id"] = "simple/layers" buildpackManager.PrepareBuildpacks(tmpDir, builderBuildpacks...) @@ -2303,11 +2290,6 @@ func createBuilder( // RENDER builder.toml configFileName := "builder.toml" - // NOTE: Remove when Windows-based packages are supported (can use same toml at that point) - if dockerHostOS() == "windows" { - configFileName = "builder-windows.toml" - } - builderConfigFile, err := ioutil.TempFile(tmpDir, "builder.toml") assert.Nil(err) diff --git a/acceptance/buildpacks/package_image_buildpack.go b/acceptance/buildpacks/package_image_buildpack.go index e2302a49b8..fc616176a9 100644 --- a/acceptance/buildpacks/package_image_buildpack.go +++ b/acceptance/buildpacks/package_image_buildpack.go @@ -55,7 +55,6 @@ func NewPackageImage( for _, mod := range modifiers { mod(&p) } - return p } diff --git a/acceptance/testdata/pack_fixtures/builder-windows.toml b/acceptance/testdata/pack_fixtures/builder-windows.toml deleted file mode 100644 index 94a9919811..0000000000 --- a/acceptance/testdata/pack_fixtures/builder-windows.toml +++ /dev/null @@ -1,40 +0,0 @@ -[[buildpacks]] - id = "read/env" - version = "read-env-version" - uri = "read-env-buildpack.tgz" - -[[buildpacks]] - # intentionally missing id/version as they are optional - uri = "noop-buildpack.tgz" - -[[buildpacks]] - # noop-buildpack-2 has the same id but a different version compared to noop-buildpack - uri = "noop-buildpack-2.tgz" - -[[buildpacks]] - uri = "simple-layers-buildpack.tgz" - -[[order]] - -[[order.group]] - id = "simple/layers" - # intentionlly missing version to test support - -[[order.group]] - id = "read/env" - version = "read-env-version" - optional = true - -[stack] - id = "pack.test.stack" - build-image = "pack-test/build" - run-image = "pack-test/run" - run-image-mirrors = ["{{.run_image_mirror}}"] - -[lifecycle] -{{- if .lifecycle_uri}} - uri = "{{.lifecycle_uri}}" -{{- end}} -{{- if .lifecycle_version}} - version = "{{.lifecycle_version}}" -{{- end}}