--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
@@ -265,18 +265,18 @@ add_task(async function test_backoffTime
[pingSendTimerCallback, pingSendTimeout] = await timerPromise;
Assert.equal(pingSendTimeout, MAX_BACKOFF_TIMEOUT, "Tick timeout should be capped");
++sendAttempts;
Assert.deepEqual(histSuccess.snapshot().counts, [sendAttempts, 0, 0],
"Should have recorded sending failure in histograms.");
Assert.equal(histSendTimeSuccess.snapshot().sum, 0,
"Should not have recorded any sending success in histograms yet.");
- Assert.greater(histSendTimeFail.snapshot().sum, 0,
- "Should have recorded send failure times in histograms.");
+ Assert.greaterOrEqual(histSendTimeFail.snapshot().sum, 0,
+ "Should have recorded send failure times in histograms.");
Assert.equal(histogramValueCount(histSendTimeFail.snapshot()), sendAttempts,
"Should have recorded send failure times in histograms.");
// Submitting a new ping should reset the backoff behavior.
fakePingId("d", 0);
now = fakeNow(futureDate(now, MS_IN_A_MINUTE));
timerPromise = waitForTimer();
await TelemetryController.submitExternalPing(TEST_TYPE_D, {});
@@ -300,18 +300,18 @@ add_task(async function test_backoffTime
Assert.equal(countByType.get(TEST_TYPE_D), 1, "Should have received the correct amount of type D pings");
Assert.equal(countByType.get(TEST_TYPE_E), 1, "Should have received the correct amount of type E pings");
await TelemetrySend.testWaitOnOutgoingPings();
Assert.equal(TelemetrySend.pendingPingCount, 0, "Should have no pending pings left");
Assert.deepEqual(histSuccess.snapshot().counts, [sendAttempts, 3, 0],
"Should have recorded sending failure in histograms.");
- Assert.greater(histSendTimeSuccess.snapshot().sum, 0,
- "Should have recorded sending success in histograms.");
+ Assert.greaterOrEqual(histSendTimeSuccess.snapshot().sum, 0,
+ "Should have recorded sending success in histograms.");
Assert.equal(histogramValueCount(histSendTimeSuccess.snapshot()), 3,
"Should have recorded sending success in histograms.");
Assert.equal(histogramValueCount(histSendTimeFail.snapshot()), sendAttempts,
"Should have recorded send failure times in histograms.");
});
add_task(async function test_discardBigPings() {
const TEST_PING_TYPE = "test-ping-type";
@@ -332,29 +332,29 @@ add_task(async function test_discardBigP
await TelemetryController.submitExternalPing(TEST_PING_TYPE, { test: "test" });
await TelemetrySend.testWaitOnOutgoingPings();
await PingServer.promiseNextPing();
Assert.equal(histSizeExceeded.snapshot().sum, 0, "Telemetry must report no oversized ping submitted.");
Assert.equal(histDiscardedSize.snapshot().sum, 0, "Telemetry must report no oversized pings.");
Assert.deepEqual(histSuccess.snapshot().counts, [0, 1, 0], "Should have recorded sending success.");
Assert.equal(histogramValueCount(histSendTimeSuccess.snapshot()), 1, "Should have recorded send success time.");
- Assert.greater(histSendTimeSuccess.snapshot().sum, 0, "Should have recorded send success time.");
+ Assert.greaterOrEqual(histSendTimeSuccess.snapshot().sum, 0, "Should have recorded send success time.");
Assert.equal(histogramValueCount(histSendTimeFail.snapshot()), 0, "Should not have recorded send failure time.");
// Submit an oversized ping and check that it gets discarded.
TelemetryHealthPing.testReset();
await TelemetryController.submitExternalPing(TEST_PING_TYPE, OVERSIZED_PAYLOAD);
let ping = await PingServer.promiseNextPing();
Assert.equal(histSizeExceeded.snapshot().sum, 1, "Telemetry must report 1 oversized ping submitted.");
Assert.equal(histDiscardedSize.snapshot().counts[2], 1, "Telemetry must report a 2MB, oversized, ping submitted.");
Assert.deepEqual(histSuccess.snapshot().counts, [0, 2, 0], "Should have recorded sending success.");
Assert.equal(histogramValueCount(histSendTimeSuccess.snapshot()), 2, "Should have recorded send success time.");
- Assert.greater(histSendTimeSuccess.snapshot().sum, 0, "Should have recorded send success time.");
+ Assert.greaterOrEqual(histSendTimeSuccess.snapshot().sum, 0, "Should have recorded send success time.");
Assert.equal(histogramValueCount(histSendTimeFail.snapshot()), 0, "Should not have recorded send failure time.");
Assert.equal(ping.type, TelemetryHealthPing.HEALTH_PING_TYPE, "Should have received a health ping.");
Assert.deepEqual(ping.payload[TelemetryHealthPing.FailureType.DISCARDED_FOR_SIZE],
{[TEST_PING_TYPE]: 1}, "Should have recorded correct type of oversized ping.");
Assert.deepEqual(ping.payload.os, TelemetryHealthPing.OsInfo, "Should have correct os info.")
});
@@ -382,17 +382,17 @@ add_task(async function test_evictedOnSe
// Clear the histogram and submit a ping.
let pingId = await TelemetryController.submitExternalPing(TEST_TYPE, {});
await TelemetrySend.testWaitOnOutgoingPings();
Assert.equal(histEvicted.snapshot().sum, 1,
"Telemetry must report a ping evicted due to server errors");
Assert.deepEqual(histSuccess.snapshot().counts, [0, 1, 0]);
Assert.equal(histogramValueCount(histSendTimeSuccess.snapshot()), 1);
- Assert.greater(histSendTimeSuccess.snapshot().sum, 0);
+ Assert.greaterOrEqual(histSendTimeSuccess.snapshot().sum, 0);
Assert.equal(histogramValueCount(histSendTimeFail.snapshot()), 0);
// The ping should not be persisted.
await Assert.rejects(TelemetryStorage.loadPendingPing(pingId), "The ping must not be persisted.");
// Reset the ping handler and submit a new ping.
PingServer.resetPingHandler();
pingId = await TelemetryController.submitExternalPing(TEST_TYPE, {});