diff --git a/src/test/java/io/supertokens/test/TelemetryTest.java b/src/test/java/io/supertokens/test/TelemetryTest.java index b4f8eb463..d351e84c6 100644 --- a/src/test/java/io/supertokens/test/TelemetryTest.java +++ b/src/test/java/io/supertokens/test/TelemetryTest.java @@ -23,6 +23,8 @@ import io.supertokens.cronjobs.telemetry.Telemetry; import io.supertokens.dashboard.Dashboard; import io.supertokens.httpRequest.HttpRequestMocking; +import io.supertokens.pluginInterface.STORAGE_TYPE; +import io.supertokens.storageLayer.StorageLayer; import io.supertokens.test.TestingProcessManager.TestingProcess; import io.supertokens.version.Version; import org.junit.AfterClass; @@ -115,8 +117,9 @@ public void testThatTelemetryWorks() throws Exception { process.startProcess(); assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); - Dashboard.signUpDashboardUser(process.getProcess(), "test@example.com", "password123"); - + if (StorageLayer.getBaseStorage(process.getProcess()).getType() == STORAGE_TYPE.SQL) { + Dashboard.signUpDashboardUser(process.getProcess(), "test@example.com", "password123"); + } // Restarting the process to send telemetry again process.kill(false); process = TestingProcessManager.start(args, false); @@ -167,9 +170,17 @@ protected URLConnection openConnection(URL u) { assertEquals(telemetryData.get("connectionUriDomain").getAsString(), ""); assertTrue(telemetryData.has("maus")); assertTrue(telemetryData.has("dashboardUserEmails")); - assertEquals(1, telemetryData.get("dashboardUserEmails").getAsJsonArray().size()); - assertEquals("test@example.com", telemetryData.get("dashboardUserEmails").getAsJsonArray().get(0).getAsString()); - assertEquals(31, telemetryData.get("maus").getAsJsonArray().size()); + + if (StorageLayer.getBaseStorage(process.getProcess()).getType() == STORAGE_TYPE.SQL) { + assertEquals(1, telemetryData.get("dashboardUserEmails").getAsJsonArray().size()); + assertEquals("test@example.com", telemetryData.get("dashboardUserEmails").getAsJsonArray().get(0).getAsString()); + assertEquals(31, telemetryData.get("maus").getAsJsonArray().size()); + assertEquals(0, telemetryData.get("usersCount").getAsInt()); + } else { + assertEquals(0, telemetryData.get("dashboardUserEmails").getAsJsonArray().size()); + assertEquals(0, telemetryData.get("maus").getAsJsonArray().size()); + assertEquals(-1, telemetryData.get("usersCount").getAsInt()); + } process.kill(); assertNotNull(process.checkOrWaitForEvent(PROCESS_STATE.STOPPED));