diff --git a/Makefile b/Makefile index 49d0d97ec..7d2c7850b 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ TEST_IMAGE := quay.io/skupper/skupper-tests TEST_BINARIES_FOLDER := ${PWD}/test/integration/bin DOCKER := docker LDFLAGS := -X github.com/skupperproject/skupper/pkg/version.Version=${VERSION} -PLATFORMS ?= linux/amd64,linux/arm64 +PLATFORMS ?= linux/amd64,linux/arm64,linux/s390x GOOS ?= linux GOARCH ?= amd64 diff --git a/test/images/Makefile b/test/images/Makefile index cd1cd7d11..602280f5c 100644 --- a/test/images/Makefile +++ b/test/images/Makefile @@ -86,7 +86,7 @@ SKOPEO = skopeo # That is required for their use with Openshift 3.11 FORMAT_OPTIONS = --format docker TRANSFORM_OPTIONS = --format v2s2 -PLATFORM = linux/amd64,linux/arm64 +PLATFORM = linux/amd64,linux/arm64,linux/s390x # Repositories MAIN_REPO = quay.io/skupper diff --git a/test/integration/acceptance/gateway_test.go b/test/integration/acceptance/gateway_test.go index 1ea08fb89..c654434c9 100644 --- a/test/integration/acceptance/gateway_test.go +++ b/test/integration/acceptance/gateway_test.go @@ -16,6 +16,7 @@ import ( "strconv" "testing" "time" + "runtime" "github.com/skupperproject/skupper/test/integration/acceptance/gateway" "github.com/skupperproject/skupper/test/integration/examples/tcp_echo" @@ -49,6 +50,9 @@ func TestGateway(t *testing.T) { // port reaching out tcp-echo-cluster service using a // dynamic port func testLocalGatewayService(t *testing.T) { + if runtime.GOARCH == "s390x" { + t.Skip("Skipping test on s390x architecture as skupper router binary is unavailable for 1.x versions") + } testLocalGateway(t, "") } diff --git a/test/integration/examples/bookinfo_test.go b/test/integration/examples/bookinfo_test.go index 521b20468..60a9c9bfe 100644 --- a/test/integration/examples/bookinfo_test.go +++ b/test/integration/examples/bookinfo_test.go @@ -8,11 +8,22 @@ import ( "testing" "github.com/skupperproject/skupper/test/integration/examples/bookinfo" + "github.com/skupperproject/skupper/test/utils/base" + "github.com/skupperproject/skupper/test/utils/arch" _ "k8s.io/client-go/plugin/pkg/client/auth" ) func TestBookinfo(t *testing.T) { + // Get the cluster context + cluster := base.GetClusterContext() + + // Skip test if the cluster architecture is s390x + if err := arch.SkipOnlyS390x(t, cluster); err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithCancel(context.Background()) defer cancel() + bookinfo.Run(ctx, t, testRunner) } diff --git a/test/integration/examples/custom/hipstershop/hipstershop_test.go b/test/integration/examples/custom/hipstershop/hipstershop_test.go index 41955a010..94e10ad94 100644 --- a/test/integration/examples/custom/hipstershop/hipstershop_test.go +++ b/test/integration/examples/custom/hipstershop/hipstershop_test.go @@ -8,10 +8,12 @@ import ( "log" "os" "testing" + "runtime" "github.com/skupperproject/skupper/test/utils/base" "github.com/skupperproject/skupper/test/utils/constants" "github.com/skupperproject/skupper/test/utils/k8s" + "github.com/skupperproject/skupper/test/utils/arch" "gotest.tools/assert" ) @@ -29,6 +31,13 @@ func TestMain(m *testing.M) { } func TestHipsterShop(t *testing.T) { + + //Skipping test on s390x architecture as images unavailable for s390x + cluster := base.GetClusterContext() + if err := arch.SkipOnlyS390x(t, cluster); err != nil { + t.Fatal(err) + } + // Cluster needs for hipster shop needs := base.ClusterNeeds{ NamespaceId: "hipster", diff --git a/test/integration/examples/mongo_test.go b/test/integration/examples/mongo_test.go index 6e69915ae..605fe550a 100644 --- a/test/integration/examples/mongo_test.go +++ b/test/integration/examples/mongo_test.go @@ -8,8 +8,16 @@ import ( "testing" "github.com/skupperproject/skupper/test/integration/examples/mongodb" + "github.com/skupperproject/skupper/test/utils/arch" + "github.com/skupperproject/skupper/test/utils/base" ) func TestMongo(t *testing.T) { + // Skip test if the cluster architecture is s390x + cluster := base.GetClusterContext() + if err := arch.SkipOnlyS390x(t, cluster); err != nil { + t.Fatal(err) + } + mongodb.Run(context.Background(), t, testRunner) } diff --git a/test/integration/performance/postgres_test.go b/test/integration/performance/postgres_test.go index fddff2402..b3f48a562 100644 --- a/test/integration/performance/postgres_test.go +++ b/test/integration/performance/postgres_test.go @@ -13,11 +13,13 @@ import ( "strconv" "strings" "testing" + "runtime" "time" "github.com/skupperproject/skupper/test/integration/performance/common" "github.com/skupperproject/skupper/test/utils/base" "github.com/skupperproject/skupper/test/utils/k8s" + "github.com/skupperproject/skupper/test/utils/arch" "gotest.tools/assert" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" @@ -45,6 +47,11 @@ type postgresSettings struct { } func TestPostgres(t *testing.T) { + // Skip test if the cluster architecture is s390x + cluster := base.GetClusterContext() + if err := arch.SkipOnlyS390x(t, cluster); err != nil { + t.Fatal(err) + } // TestPostgres is currently not functional for ARM // https://github.com/skupperproject/skupper/issues/1650 common.CheckArch(t) diff --git a/test/utils/arch/k8s.go b/test/utils/arch/k8s.go index b13082e0e..9f061d83f 100644 --- a/test/utils/arch/k8s.go +++ b/test/utils/arch/k8s.go @@ -53,3 +53,38 @@ func Skip(t *testing.T, clusters ...*base.ClusterContext) error { } return err } + +// CheckOnlyS390x skips ONLY if the architecture is s390x +func CheckOnlyS390x(clusters ...*base.ClusterContext) (err error, skip bool) { + + ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10) + defer cancel() + + for _, c := range clusters { + list, err := c.VanClient.KubeClient.CoreV1().Nodes().List(ctx, v1.ListOptions{}) + if err != nil { + return err, false + } + for _, node := range list.Items { + arch := node.Labels["beta.kubernetes.io/arch"] + if arch == "s390x" { + return fmt.Errorf( + "at least one cluster node is s390x -- skipping (%s at %s is %q)", + node.Name, + c.VanClient.RestConfig.Host, + arch, + ), true + } + } + } + return nil, false +} + +// SkipOnlyS390x skips the test only for s390x clusters +func SkipOnlyS390x(t *testing.T, clusters ...*base.ClusterContext) error { + err, skip := CheckOnlyS390x(clusters...) + if skip { + t.Skipf("%v", err) + } + return err +}