fix(cron): prevent telemetry ping when telemetry is disabled (#3313)
this updates the cron to avoid running the telemetry ping when telemetry is disabled so that personally identifiable information is not sent off to other parties (an IP address, an installation ID)
This commit is contained in:
@@ -84,7 +84,19 @@ class CronServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void sendPing_postSuccess_savesSettings() {
|
||||
void sendPing_telemetryDisabled_doesNotSend() {
|
||||
AppSettings settings = mock(AppSettings.class);
|
||||
when(appSettingService.getAppSettings()).thenReturn(settings);
|
||||
when(settings.isTelemetryEnabled()).thenReturn(false);
|
||||
cronService.sendPing();
|
||||
verifyNoInteractions(restClient);
|
||||
}
|
||||
|
||||
@Test
|
||||
void sendPing_telemetryEnabled_postSuccess_savesSettings() {
|
||||
AppSettings settings = mock(AppSettings.class);
|
||||
when(appSettingService.getAppSettings()).thenReturn(settings);
|
||||
when(settings.isTelemetryEnabled()).thenReturn(true);
|
||||
when(appProperties.getTelemetry().getBaseUrl()).thenReturn("http://telemetry");
|
||||
InstallationPing ping = InstallationPing.builder().appVersion("1.0.0").build();
|
||||
when(telemetryService.getInstallationPing()).thenReturn(ping);
|
||||
@@ -99,7 +111,10 @@ class CronServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void sendPing_postFails_doesNotSaveSettings() {
|
||||
void sendPing_telemetryEnabled_postFails_doesNotSaveSettings() {
|
||||
AppSettings settings = mock(AppSettings.class);
|
||||
when(appSettingService.getAppSettings()).thenReturn(settings);
|
||||
when(settings.isTelemetryEnabled()).thenReturn(true);
|
||||
when(appProperties.getTelemetry().getBaseUrl()).thenReturn("http://telemetry");
|
||||
InstallationPing ping = InstallationPing.builder().appVersion("1.0.0").build();
|
||||
when(telemetryService.getInstallationPing()).thenReturn(ping);
|
||||
|
||||
Reference in New Issue
Block a user