diff --git a/.drone.jsonnet b/.drone.jsonnet index 2ddcf2ef..23371dc3 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,7 +1,7 @@ local name = 'platform'; local browser = 'chrome'; -local selenium = '4.19.0-20240328'; -local go = '1.22.0'; +local selenium = '4.35.0-20250828'; +local go = '1.24.0'; local node = '22.16.0'; local deployer = 'https://github.com/syncloud/store/releases/download/4/syncloud-release'; local authelia = '4.38.8'; @@ -9,7 +9,7 @@ local distro_default = 'buster'; local distros = ['bookworm', 'buster']; local bootstrap = '25.02'; local nginx = '1.24.0'; -local python = '3.8-slim-bookworm'; +local python = '3.12-slim-bookworm'; local build(arch, testUI) = [{ kind: 'pipeline', @@ -144,6 +144,7 @@ local build(arch, testUI) = [{ 'DOMAIN="' + distro_default + '-' + arch + '"', 'getent hosts $DOMAIN | sed "s/$DOMAIN/auth.$DOMAIN.redirect/g" | sudo tee -a /etc/hosts', 'getent hosts $DOMAIN | sed "s/$DOMAIN/$DOMAIN.redirect/g" | sudo tee -a /etc/hosts', + 'getent hosts $DOMAIN | sed "s/$DOMAIN/unknown.$DOMAIN.redirect/g" | sudo tee -a /etc/hosts', 'cat /etc/hosts', '/opt/bin/entry_point.sh', ], @@ -174,7 +175,7 @@ local build(arch, testUI) = [{ commands: [ 'cd test', './deps.sh', - 'py.test -x -s test-ui.py --ui-mode=' + mode + ' --domain=' + distro_default + '-' + arch + ' --device-host=' + distro_default + '-' + arch + ' --redirect-user=redirect --redirect-password=redirect --app=' + name + ' --browser=' + browser, + 'py.test -x -s ui.py --ui-mode=' + mode + ' --domain=' + distro_default + '-' + arch + ' --device-host=' + distro_default + '-' + arch + ' --redirect-user=redirect --redirect-password=redirect --app=' + name + ' --browser=' + browser, ], privileged: true, volumes: [{ @@ -192,7 +193,7 @@ local build(arch, testUI) = [{ 'APP_ARCHIVE_PATH=$(realpath $(cat package.name))', 'cd test', './deps.sh', - 'py.test -x -s test-upgrade.py --domain=' + distro_default + '-' + arch + ' --device-host=' + distro_default + '-' + arch + ' --app-archive-path=$APP_ARCHIVE_PATH --app=' + name, + 'py.test -x -s upgrade.py --domain=' + distro_default + '-' + arch + ' --device-host=' + distro_default + '-' + arch + ' --app-archive-path=$APP_ARCHIVE_PATH --app=' + name, ], privileged: true, volumes: [{ diff --git a/config/errors/502.html b/config/errors/502.html new file mode 100644 index 00000000..b865ee46 --- /dev/null +++ b/config/errors/502.html @@ -0,0 +1,105 @@ + + + + + + Service Temporarily Unavailable + + + +
+
Error 502
+

App is not available or still starting.

+ +
+ + Refresh + +
+ +
+

What you can do:

+ +
+
+ + + diff --git a/config/nginx/public.conf b/config/nginx/public.conf index cac4faa0..e3e8787e 100644 --- a/config/nginx/public.conf +++ b/config/nginx/public.conf @@ -31,6 +31,8 @@ http { #less slow sd card io proxy_buffering off; + + # internal ui redirect for backwards compatibility server { @@ -70,6 +72,7 @@ http { add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; add_header 'Access-Control-Allow-Origin' '*'; + location /rest { proxy_pass http://unix:/var/snap/platform/current/backend.sock: ; } @@ -137,6 +140,15 @@ http { add_header Strict-Transport-Security "max-age=31536000; includeSubdomains"; + error_page 502 /502.html; + error_page 503 /502.html; + error_page 504 /502.html; + + location = /502.html { + root /snap/platform/current/config/errors; + internal; + } + location / { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $http_host; @@ -152,5 +164,3 @@ http { } } - - diff --git a/test/pytest.ini b/test/pytest.ini new file mode 100644 index 00000000..f184d3be --- /dev/null +++ b/test/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +log_cli = True +log_level=INFO \ No newline at end of file diff --git a/test/requirements.txt b/test/requirements.txt index fb6357f7..138e851d 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1,4 +1,6 @@ -pytest==6.2.4 +pytest==8.4.1 +selenium==4.35.0 +syncloud-lib==356 +pytest-retry==1.6.3 +retrying==1.4.2 responses==0.5.0 -selenium==3.141.0 -syncloud-lib==305 diff --git a/test/test-ui.py b/test/ui.py similarity index 98% rename from test/test-ui.py rename to test/ui.py index c393602c..3fd99c99 100644 --- a/test/test-ui.py +++ b/test/ui.py @@ -263,6 +263,7 @@ def test_settings_deactivate(selenium, device_host, full_domain, selenium.find_by_xpath("//h1[text()='Applications']") selenium.screenshot('reactivate-index') + def test_permission_denied(selenium, device, ui_mode): device.run_ssh('/snap/platform/current/openldap/bin/ldapadd.sh -x -w syncloud -D "dc=syncloud,dc=org" -f /test/test.{0}.ldif'.format(ui_mode)) menu(selenium, 'logout') @@ -273,6 +274,12 @@ def test_permission_denied(selenium, device, ui_mode): selenium.find_by_xpath("//div[contains(.,'not admin')]") selenium.screenshot('permission-denied') + +def test_502(selenium, full_domain): + selenium.driver.get("https://unknown.{0}".format(full_domain)) + selenium.find_by_xpath("//h2[contains(.,'App is not available')]") + + def menu(selenium, element_id): retries = 10 retry = 0 @@ -326,7 +333,3 @@ def settings(selenium, setting): def wait_for_loading(driver): wait_driver = WebDriverWait(driver, 120) wait_driver.until(EC.invisibility_of_element_located((By.CLASS_NAME, 'el-loading-mask'))) - - -def test_teardown(driver): - driver.quit() diff --git a/test/test-upgrade.py b/test/upgrade.py similarity index 100% rename from test/test-upgrade.py rename to test/upgrade.py