From 12edc5221ad8136383b459a35538b96bf7607c7a Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 14:40:03 -0400 Subject: [PATCH 01/14] update --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 36f6a6d60c8..1d4bb43931f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - MYSQL_RANDOM_ROOT_PASSWORD=yes selenium: - image: selenium/standalone-firefox-debug:3.141.59-zirconium + image: selenium/standalone-firefox:131.0-20241010 volumes: - /dev/shm:/dev/shm ports: From 0c1b8811bb81ba7c86cf389e6d3c757d9eeb7f16 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 14:51:26 -0400 Subject: [PATCH 02/14] tet --- test/wait-for-services.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/wait-for-services.sh b/test/wait-for-services.sh index 4b6baf087e6..5fc1070f762 100755 --- a/test/wait-for-services.sh +++ b/test/wait-for-services.sh @@ -14,7 +14,7 @@ done if [ -v SELENIUM_REQUIRED ]; then echo "Waiting for Selenium..." - until $(curl --output /dev/null --silent --head --fail http://selenium:4444/wd/hub); do + until $(curl --output /dev/null --silent --head --fail http://localhost:4444/wd/hub); do sleep 1 done echo "Selenium is alive" From fc94e2b479b7bbad451715cd33fca313866e2699 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 15:20:48 -0400 Subject: [PATCH 03/14] test --- docker-compose.yml | 68 ++++++++-------------------------------------- 1 file changed, 11 insertions(+), 57 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1d4bb43931f..b8f5d5e228c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3.8' services: db: build: @@ -13,11 +13,14 @@ services: - MYSQL_RANDOM_ROOT_PASSWORD=yes selenium: - image: selenium/standalone-firefox:131.0-20241010 + image: selenium/standalone-firefox:latest volumes: - /dev/shm:/dev/shm ports: - - "5900:5900" + - "4444:4444" # Selenium WebDriver port + - "5900:5900" + networks: + - app-network web: build: @@ -32,6 +35,8 @@ services: depends_on: - db command: php -S 0.0.0.0:8000 -t /app/htdocs /app/htdocs/router.php + networks: + - app-network unit-tests: build: @@ -63,57 +68,6 @@ services: - web entrypoint: /app/test/wait-for-services.sh - selenium-debug: - image: selenium/standalone-firefox-debug:3.141.59-zirconium - links: - - web-debug:web - ports: - - "5901:5900" - - web-debug: - build: - context: . - dockerfile: Dockerfile.test.php8.debug - volumes: - - ./:/app - - ./test/test_instrument:/app/project/instruments - environment: - - LORIS_DB_CONFIG=/app/test/config.xml - - XDEBUG_CONFIG=remote_host=${XDEBUG_REMOTE_HOST} - - PHP_IDE_CONFIG=serverName=LorisTests - depends_on: - - db - command: php -S 0.0.0.0:8000 -t /app/htdocs /app/htdocs/router.php - - unit-tests-debug: - build: - context: . - dockerfile: Dockerfile.test.php8.debug - volumes: - - ./:/app - working_dir: /app - environment: - - LORIS_DB_CONFIG=test/config.xml - - XDEBUG_CONFIG=remote_host=${XDEBUG_REMOTE_HOST} - - PHP_IDE_CONFIG=serverName=LorisTests - depends_on: - - db - entrypoint: /app/test/wait-for-services.sh - - integration-tests-debug: - build: - context: . - dockerfile: Dockerfile.test.php8.debug - volumes: - - ./:/app - working_dir: /app - environment: - - LORIS_DB_CONFIG=test/config.xml - - SELENIUM_REQUIRED=true - - XDEBUG_CONFIG=remote_host=${XDEBUG_REMOTE_HOST} - - PHP_IDE_CONFIG=serverName=LorisTests - links: - - db - - selenium-debug:selenium - - web-debug:web - entrypoint: /app/test/wait-for-services.sh +networks: + app-network: + driver: bridge From 463101f861d056a312b330acf0711b2d9911a4c6 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 15:32:34 -0400 Subject: [PATCH 04/14] tet --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b8f5d5e228c..e860c146bb0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,8 +35,6 @@ services: depends_on: - db command: php -S 0.0.0.0:8000 -t /app/htdocs /app/htdocs/router.php - networks: - - app-network unit-tests: build: @@ -67,6 +65,8 @@ services: - selenium - web entrypoint: /app/test/wait-for-services.sh + networks: + - app-network networks: app-network: From 8bafe3af723d6d96cfd65e0123fd511722708b91 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 15:44:48 -0400 Subject: [PATCH 05/14] 4.25 --- docker-compose.yml | 10 +--------- test/wait-for-services.sh | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e860c146bb0..dca01b06e7f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,14 +13,12 @@ services: - MYSQL_RANDOM_ROOT_PASSWORD=yes selenium: - image: selenium/standalone-firefox:latest + image: selenium/standalone-firefox:4.25 volumes: - /dev/shm:/dev/shm ports: - "4444:4444" # Selenium WebDriver port - "5900:5900" - networks: - - app-network web: build: @@ -65,9 +63,3 @@ services: - selenium - web entrypoint: /app/test/wait-for-services.sh - networks: - - app-network - -networks: - app-network: - driver: bridge diff --git a/test/wait-for-services.sh b/test/wait-for-services.sh index 5fc1070f762..e6f603ff7e0 100755 --- a/test/wait-for-services.sh +++ b/test/wait-for-services.sh @@ -11,13 +11,23 @@ while ! mysqladmin ping -h db -u SQLTestUser --password="TestPassword" --silent sleep 1 done -if [ -v SELENIUM_REQUIRED ]; -then - echo "Waiting for Selenium..." - until $(curl --output /dev/null --silent --head --fail http://localhost:4444/wd/hub); do - sleep 1 - done - echo "Selenium is alive" -fi +check_selenium() { + local url=$1 + until $(curl --output /dev/null --silent --head --fail "$url"); do + printf 'Waiting for Selenium server on %s...\n' "$url" + sleep 5 + done + printf 'Selenium server is up and running on %s!\n' "$url" +} + +# Check on localhost + +# Check on Docker internal network (service name) +check_selenium http://localhost:4444/wd/hub & + +# Check on 127.0.0.1 + +# Wait for any check to complete +wait exec $cmd From 265b81dcd8387fac22cda78ca6733ebafce14103 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 15:48:21 -0400 Subject: [PATCH 06/14] try --- test/wait-for-services.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/wait-for-services.sh b/test/wait-for-services.sh index e6f603ff7e0..db83ca39dc9 100755 --- a/test/wait-for-services.sh +++ b/test/wait-for-services.sh @@ -23,8 +23,17 @@ check_selenium() { # Check on localhost # Check on Docker internal network (service name) + +# Check on localhost check_selenium http://localhost:4444/wd/hub & +# Check on Docker internal network (service name) +check_selenium http://selenium:4444/wd/hub & + +# Check on 127.0.0.1 +check_selenium http://127.0.0.1:4444/wd/hub & + + # Check on 127.0.0.1 # Wait for any check to complete From 731dc00d36f3d15ab26873e32f42ef322567a2b6 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 16:06:10 -0400 Subject: [PATCH 07/14] try --- docker-compose.yml | 20 +++++++++++++------- test/wait-for-services.sh | 37 ++++++++++--------------------------- 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index dca01b06e7f..a7b62032b4f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,13 +12,19 @@ services: - MYSQL_DATABASE=LorisTest - MYSQL_RANDOM_ROOT_PASSWORD=yes - selenium: - image: selenium/standalone-firefox:4.25 - volumes: - - /dev/shm:/dev/shm - ports: - - "4444:4444" # Selenium WebDriver port - - "5900:5900" + selenium: + image: selenium/standalone-firefox:4.25 + ports: + - 4444:4444 + - 5900:5900 + options: >- + --shm-size=2g + # Optional: Define a health check to ensure the service is ready + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] + interval: 10s + timeout: 5s + retries: 3 web: build: diff --git a/test/wait-for-services.sh b/test/wait-for-services.sh index db83ca39dc9..f6ebaf25ebb 100755 --- a/test/wait-for-services.sh +++ b/test/wait-for-services.sh @@ -11,32 +11,15 @@ while ! mysqladmin ping -h db -u SQLTestUser --password="TestPassword" --silent sleep 1 done -check_selenium() { - local url=$1 - until $(curl --output /dev/null --silent --head --fail "$url"); do - printf 'Waiting for Selenium server on %s...\n' "$url" - sleep 5 - done - printf 'Selenium server is up and running on %s!\n' "$url" -} - -# Check on localhost - -# Check on Docker internal network (service name) - -# Check on localhost -check_selenium http://localhost:4444/wd/hub & - -# Check on Docker internal network (service name) -check_selenium http://selenium:4444/wd/hub & - -# Check on 127.0.0.1 -check_selenium http://127.0.0.1:4444/wd/hub & - - -# Check on 127.0.0.1 - -# Wait for any check to complete -wait +if [ -v SELENIUM_REQUIRED ]; +then + echo "Waiting for Selenium..." + # Changed to localhost:4444 + until $(curl --output /dev/null --silent --head --fail http://localhost:4444/wd/hub); do + sleep 1 + done + echo "Selenium is alive" +fi exec $cmd + From cdf3cc2f1c6abe81105a74ba8f6283fc89b09eb0 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 16:09:02 -0400 Subject: [PATCH 08/14] try --- docker-compose.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a7b62032b4f..2c26aedc6b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,19 +12,19 @@ services: - MYSQL_DATABASE=LorisTest - MYSQL_RANDOM_ROOT_PASSWORD=yes - selenium: - image: selenium/standalone-firefox:4.25 - ports: - - 4444:4444 - - 5900:5900 - options: >- - --shm-size=2g - # Optional: Define a health check to ensure the service is ready - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] - interval: 10s - timeout: 5s - retries: 3 + selenium: + image: selenium/standalone-firefox:4.25 + ports: + - 4444:4444 + - 5900:5900 + options: >- + --shm-size=2g + # Optional: Define a health check to ensure the service is ready + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] + interval: 10s + timeout: 5s + retries: 3 web: build: From 3d3be1516a796da50667d12e934d4dad5a55378a Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 16:16:16 -0400 Subject: [PATCH 09/14] test --- docker-compose.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2c26aedc6b7..acc97f9b57c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,17 +14,17 @@ services: selenium: image: selenium/standalone-firefox:4.25 - ports: - - 4444:4444 - - 5900:5900 - options: >- - --shm-size=2g - # Optional: Define a health check to ensure the service is ready - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] - interval: 10s - timeout: 5s - retries: 3 + ports: + - "4444:4444" # Selenium WebDriver port + - "5900:5900" # VNC Viewer port (optional for VNC) + options: >- + --shm-size=2g + # Optional: Define a health check to ensure the service is ready + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] + interval: 10s + timeout: 5s + retries: 3 web: build: From a41675b549b311150f96f85f8a8824465e07c329 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 16:18:48 -0400 Subject: [PATCH 10/14] test --- docker-compose.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index acc97f9b57c..7b7437d4cc5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,9 +17,6 @@ services: ports: - "4444:4444" # Selenium WebDriver port - "5900:5900" # VNC Viewer port (optional for VNC) - options: >- - --shm-size=2g - # Optional: Define a health check to ensure the service is ready healthcheck: test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] interval: 10s From 8162ecc5a2dc7ed855fa90d0eab58d197c6a2ac5 Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 16:25:39 -0400 Subject: [PATCH 11/14] test --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 7b7437d4cc5..bd87526d47e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,7 @@ services: ports: - "4444:4444" # Selenium WebDriver port - "5900:5900" # VNC Viewer port (optional for VNC) + shm_size: 2g healthcheck: test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] interval: 10s From 5c4dff9d0ba11a1a7fe228721449e047b304d33c Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 16:38:01 -0400 Subject: [PATCH 12/14] test --- docker-compose.yml | 6 ------ test/wait-for-services.sh | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bd87526d47e..386fcf86015 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,12 +17,6 @@ services: ports: - "4444:4444" # Selenium WebDriver port - "5900:5900" # VNC Viewer port (optional for VNC) - shm_size: 2g - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"] - interval: 10s - timeout: 5s - retries: 3 web: build: diff --git a/test/wait-for-services.sh b/test/wait-for-services.sh index f6ebaf25ebb..84cd186d637 100755 --- a/test/wait-for-services.sh +++ b/test/wait-for-services.sh @@ -15,7 +15,7 @@ if [ -v SELENIUM_REQUIRED ]; then echo "Waiting for Selenium..." # Changed to localhost:4444 - until $(curl --output /dev/null --silent --head --fail http://localhost:4444/wd/hub); do + until $(curl --output /dev/null --silent --head --fail http://selenium:4444/wd/hub); do sleep 1 done echo "Selenium is alive" From b5c6100ca73fac4eaf8d552aa631260357a835cf Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Thu, 10 Oct 2024 16:42:38 -0400 Subject: [PATCH 13/14] test --- test/wait-for-services.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/wait-for-services.sh b/test/wait-for-services.sh index 84cd186d637..2fd3dfe6c17 100755 --- a/test/wait-for-services.sh +++ b/test/wait-for-services.sh @@ -15,7 +15,7 @@ if [ -v SELENIUM_REQUIRED ]; then echo "Waiting for Selenium..." # Changed to localhost:4444 - until $(curl --output /dev/null --silent --head --fail http://selenium:4444/wd/hub); do + until $(curl --output /dev/null --silent --head --fail http://selenium:4444/status); do sleep 1 done echo "Selenium is alive" From 26b370cd8022283e2b22fedee4f323ea8e08e8d8 Mon Sep 17 00:00:00 2001 From: Shen Date: Thu, 10 Oct 2024 16:54:56 -0400 Subject: [PATCH 14/14] Update wait-for-services.sh --- test/wait-for-services.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test/wait-for-services.sh b/test/wait-for-services.sh index 2fd3dfe6c17..643743ebc69 100755 --- a/test/wait-for-services.sh +++ b/test/wait-for-services.sh @@ -14,7 +14,6 @@ done if [ -v SELENIUM_REQUIRED ]; then echo "Waiting for Selenium..." - # Changed to localhost:4444 until $(curl --output /dev/null --silent --head --fail http://selenium:4444/status); do sleep 1 done