From cd42518b93113671220a6acae47b8d23bbe33f96 Mon Sep 17 00:00:00 2001 From: Domenico Luciani Date: Wed, 30 Aug 2023 21:04:56 +0200 Subject: [PATCH] Remove legacy guards and add test support to arm64 Signed-off-by: Domenico Luciani --- acceptance/builder_test.go | 3 ++- acceptance/detector_test.go | 28 ++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/acceptance/builder_test.go b/acceptance/builder_test.go index 38a4b2524..1dec4a669 100644 --- a/acceptance/builder_test.go +++ b/acceptance/builder_test.go @@ -27,7 +27,6 @@ var ( func TestBuilder(t *testing.T) { h.SkipIf(t, runtime.GOOS == "windows", "Builder acceptance tests are not yet supported on Windows") - h.SkipIf(t, runtime.GOARCH != "amd64", "Builder acceptance tests are not yet supported on non-amd64") info, err := h.DockerCli(t).Info(context.TODO()) h.AssertNil(t, err) @@ -39,6 +38,8 @@ func TestBuilder(t *testing.T) { builderDaemonArch = info.Architecture if builderDaemonArch == "x86_64" { builderDaemonArch = "amd64" + } else if builderDaemonArch == "aarch64" { + builderDaemonArch = "arm64" } h.MakeAndCopyLifecycle(t, builderDaemonOS, builderDaemonArch, builderBinaryDir) diff --git a/acceptance/detector_test.go b/acceptance/detector_test.go index 8ab7609cc..285e4885a 100644 --- a/acceptance/detector_test.go +++ b/acceptance/detector_test.go @@ -4,6 +4,7 @@ package acceptance import ( + "context" "fmt" "os" "os/exec" @@ -22,17 +23,32 @@ import ( ) var ( - detectDockerContext = filepath.Join("testdata", "detector") - detectorBinaryDir = filepath.Join("testdata", "detector", "container", "cnb", "lifecycle") - detectImage = "lifecycle/acceptance/detector" - userID = "1234" + detectDockerContext = filepath.Join("testdata", "detector") + detectorBinaryDir = filepath.Join("testdata", "detector", "container", "cnb", "lifecycle") + detectImage = "lifecycle/acceptance/detector" + userID = "1234" + detectorDaemonOS, detectorDaemonArch string ) func TestDetector(t *testing.T) { h.SkipIf(t, runtime.GOOS == "windows", "Detector acceptance tests are not yet supported on Windows") - h.SkipIf(t, runtime.GOARCH != "amd64", "Detector acceptance tests are not yet supported on non-amd64") - h.MakeAndCopyLifecycle(t, "linux", "amd64", detectorBinaryDir) + info, err := h.DockerCli(t).Info(context.TODO()) + h.AssertNil(t, err) + + // These variables are clones of the variables in analyzer_test.go. + // You can find the same variables there without `builder` prefix. + // These lines are added for supporting windows tests. + detectorDaemonOS = info.OSType + detectorDaemonArch = info.Architecture + if detectorDaemonArch == "x86_64" { + detectorDaemonArch = "amd64" + } + if detectorDaemonArch == "aarch64" { + detectorDaemonArch = "arm64" + } + + h.MakeAndCopyLifecycle(t, detectorDaemonOS, detectorDaemonArch, detectorBinaryDir) h.DockerBuild(t, detectImage, detectDockerContext,