From f823a7412364f636a6447e1cbeae7d00a7fc825c Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Sun, 18 Oct 2026 14:24:18 +0200 Subject: [PATCH] Fix flaky QrCodeSettingsControllerTest deep link host test WhiteLabelingControllerTest saves the system-level login white-labeling params with baseUrl "https://domain.com" and never restores them. The params persist in the shared test database, so when QrCodeSettingsControllerTest runs later in the same JVM, getBaseUrl() resolves the system base URL to domain.com and testGetMobileDeepLink fails with expected "localhost" but was "domain.com". Reset system white-labeling settings after every WhiteLabelingControllerTest test, and reset them in QrCodeSettingsControllerTest setup as well. --- .../server/controller/QrCodeSettingsControllerTest.java | 3 ++- .../server/controller/WhiteLabelingControllerTest.java | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/QrCodeSettingsControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/QrCodeSettingsControllerTest.java index c2e2b953b2..15fe14f895 100644 --- a/application/src/test/java/org/thingsboard/server/controller/QrCodeSettingsControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/QrCodeSettingsControllerTest.java @@ -53,7 +53,8 @@ public class QrCodeSettingsControllerTest extends AbstractControllerTest { @Before public void setUp() throws Exception { - loginSysAdmin(); + // Deep link host is derived from the login white-labeling base URL; start from system defaults + resetSysAdminWhiteLabelingSettings(); MobileApp androidApp = validMobileApp( "my.android.package", PlatformType.ANDROID); StoreInfo androidStoreInfo = StoreInfo.builder() diff --git a/application/src/test/java/org/thingsboard/server/controller/WhiteLabelingControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/WhiteLabelingControllerTest.java index 83eb9384bf..8574bd7bd0 100644 --- a/application/src/test/java/org/thingsboard/server/controller/WhiteLabelingControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/WhiteLabelingControllerTest.java @@ -36,7 +36,11 @@ public class WhiteLabelingControllerTest extends AbstractControllerTest { WhiteLabelingDao whiteLabelingDao; @After - public void afterTest() { + public void afterTest() throws Exception { + // System-level login/white-labeling params are shared by every test class in the same DB; + // restore defaults so the base URL set here (e.g. "https://domain.com") does not leak. + resetSysAdminWhiteLabelingSettings(); + if (tenantId != null) { WhiteLabelingCompositeKey key = new WhiteLabelingCompositeKey(tenantId, WhiteLabelingType.MAIL_TEMPLATES); if (whiteLabelingDao.findById(SYS_TENANT_ID, key) != null) {