From 6107c4fdab38b87533915cccf5536056f79942bb Mon Sep 17 00:00:00 2001
From: Jochen Roth <jochen.roth@b13.com>
Date: Tue, 3 May 2022 11:25:24 +0200
Subject: [PATCH] [BUGFIX] Detect arm64 and switch selenium docker image
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently acceptance tests do not work on arm64 (Apple M1)
due to the lack of support in the selenium docker image.

This has been fixed by detecting arm64 and switch to
arm64 compatible image (seleniarm/standalone-chromium).

Resolves: #97541
Releases: main, 11.5, 10.4
Change-Id: I531e7e1d7f0f11a1c6d850699eee3b4a9aa3e5d0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74513
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
---
 Build/Scripts/runTests.sh                     | 11 +++++++++++
 Build/testing-docker/local/docker-compose.yml |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh
index a29ae0addc7e..e51dc7e2c41c 100755
--- a/Build/Scripts/runTests.sh
+++ b/Build/Scripts/runTests.sh
@@ -36,6 +36,7 @@ setUpDockerComposeDotEnv() {
         echo "PHP_VERSION=${PHP_VERSION}"
         echo "CHUNKS=${CHUNKS}"
         echo "THISCHUNK=${THISCHUNK}"
+        echo "DOCKER_SELENIUM_IMAGE=${DOCKER_SELENIUM_IMAGE}"
     } > .env
 }
 
@@ -335,6 +336,16 @@ MYSQL_VERSION="5.5"
 POSTGRES_VERSION="10"
 CHUNKS=0
 THISCHUNK=0
+DOCKER_SELENIUM_IMAGE="selenium/standalone-chrome:3.12"
+
+# Detect arm64 and use a seleniarm image.
+# In a perfect world selenium would have a arm64 integrated, but that is not on the horizon.
+# So for the time being we have to use seleniarm image.
+ARCH=$(uname -m)
+if [ $ARCH = "arm64" ]; then
+    DOCKER_SELENIUM_IMAGE="seleniarm/standalone-chromium:4.1.2-20220227"
+    echo "Architecture" $ARCH "requires" $DOCKER_SELENIUM_IMAGE "to run acceptance tests."
+fi
 
 # Option parsing
 # Reset in case getopts has been used previously in the shell
diff --git a/Build/testing-docker/local/docker-compose.yml b/Build/testing-docker/local/docker-compose.yml
index dfa9f3e06ff6..1026a5ea9188 100644
--- a/Build/testing-docker/local/docker-compose.yml
+++ b/Build/testing-docker/local/docker-compose.yml
@@ -1,7 +1,7 @@
 version: '2.3'
 services:
   chrome:
-    image: selenium/standalone-chrome:3.12
+    image: ${DOCKER_SELENIUM_IMAGE}
 
   mysql:
     image: mysql:${MYSQL_VERSION}
-- 
GitLab