Skip to content

Commit e86926c

Browse files
committed
Fix tests
1 parent 3138dc7 commit e86926c

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

glean/tests/core/pings/maker.spec.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("PingMaker", function() {
4141
includeClientId: true,
4242
sendIfEmpty: false,
4343
});
44-
const pingInfo = await PingMaker.buildPingInfoSection(ping);
44+
const pingInfo = await PingMaker.buildPingInfoSection(Glean.metricsDatabase, ping);
4545

4646
const startTime = new Date(pingInfo.start_time);
4747
const endTime = new Date(pingInfo.end_time);
@@ -55,7 +55,7 @@ describe("PingMaker", function() {
5555
includeClientId: true,
5656
sendIfEmpty: false,
5757
});
58-
const pingInfo = await PingMaker.buildPingInfoSection(ping);
58+
const pingInfo = await PingMaker.buildPingInfoSection(Glean.metricsDatabase, ping);
5959

6060
assert.ok("seq" in pingInfo);
6161
assert.ok("start_time" in pingInfo);
@@ -69,7 +69,7 @@ describe("PingMaker", function() {
6969
includeClientId: true,
7070
sendIfEmpty: false,
7171
});
72-
const clientInfo1 = await PingMaker.buildClientInfoSection(ping);
72+
const clientInfo1 = await PingMaker.buildClientInfoSection(Glean.metricsDatabase, ping);
7373
assert.ok("telemetry_sdk_build" in clientInfo1);
7474

7575
// Initialize will also initialize core metrics that are part of the client info.
@@ -79,7 +79,7 @@ describe("PingMaker", function() {
7979
serverEndpoint: "http://localhost:8080"
8080
});
8181

82-
const clientInfo2 = await PingMaker.buildClientInfoSection(ping);
82+
const clientInfo2 = await PingMaker.buildClientInfoSection(Glean.metricsDatabase, ping);
8383
assert.ok("telemetry_sdk_build" in clientInfo2);
8484
assert.ok("client_id" in clientInfo2);
8585
assert.ok("first_run_date" in clientInfo2);
@@ -97,7 +97,7 @@ describe("PingMaker", function() {
9797
includeClientId: true,
9898
sendIfEmpty: false,
9999
});
100-
assert.strictEqual(await PingMaker.collectPing(ping), undefined);
100+
assert.strictEqual(await PingMaker.collectPing(Glean.metricsDatabase, Glean.eventsDatabase, ping), undefined);
101101
});
102102

103103
it("sequence numbers must be sequential", async function() {
@@ -113,14 +113,14 @@ describe("PingMaker", function() {
113113
});
114114

115115
for(let i = 0; i <= 10; i++) {
116-
assert.strictEqual(await PingMaker.getSequenceNumber(ping1), i);
117-
assert.strictEqual(await PingMaker.getSequenceNumber(ping2), i);
116+
assert.strictEqual(await PingMaker.getSequenceNumber(Glean.metricsDatabase, ping1), i);
117+
assert.strictEqual(await PingMaker.getSequenceNumber(Glean.metricsDatabase, ping2), i);
118118
}
119119

120-
await PingMaker.getSequenceNumber(ping1);
121-
assert.strictEqual(await PingMaker.getSequenceNumber(ping1), 12);
122-
assert.strictEqual(await PingMaker.getSequenceNumber(ping2), 11);
123-
assert.strictEqual(await PingMaker.getSequenceNumber(ping1), 13);
120+
await PingMaker.getSequenceNumber(Glean.metricsDatabase, ping1);
121+
assert.strictEqual(await PingMaker.getSequenceNumber(Glean.metricsDatabase, ping1), 12);
122+
assert.strictEqual(await PingMaker.getSequenceNumber(Glean.metricsDatabase, ping2), 11);
123+
assert.strictEqual(await PingMaker.getSequenceNumber(Glean.metricsDatabase, ping1), 13);
124124
});
125125

126126
it("getPingHeaders returns headers when custom headers are set", async function () {
@@ -150,12 +150,12 @@ describe("PingMaker", function() {
150150
sendIfEmpty: true,
151151
});
152152

153-
await PingMaker.collectAndStorePing("ident", ping);
153+
await PingMaker.collectAndStorePing(Glean.metricsDatabase, Glean.eventsDatabase, Glean.pingsDatabase, Glean.applicationId!, "ident", ping, undefined, Glean.debugOptions);
154154
const recordedPing = (await Glean.pingsDatabase.getAllPings())["ident"];
155155
assert.deepStrictEqual(recordedPing.payload, { "you": "got mocked!" });
156156

157157
await Glean.testResetGlean(testAppId, true);
158-
await PingMaker.collectAndStorePing("ident", ping);
158+
await PingMaker.collectAndStorePing(Glean.metricsDatabase, Glean.eventsDatabase, Glean.pingsDatabase, Glean.applicationId!, "ident", ping, undefined, Glean.debugOptions);
159159
const recordedPingNoPlugin = (await Glean.pingsDatabase.getAllPings())["ident"];
160160
assert.notDeepStrictEqual(recordedPingNoPlugin.payload, { "you": "got mocked!" });
161161
});
@@ -178,7 +178,7 @@ describe("PingMaker", function() {
178178
});
179179

180180
const consoleSpy = sandbox.spy(console, "info");
181-
await PingMaker.collectAndStorePing("ident", ping);
181+
await PingMaker.collectAndStorePing(Glean.metricsDatabase, Glean.eventsDatabase, Glean.pingsDatabase, Glean.applicationId!, "ident", ping, undefined, Glean.debugOptions);
182182

183183
const loggedPayload = JSON.parse(consoleSpy.lastCall.args[0]) as JSONObject;
184184

@@ -213,7 +213,7 @@ describe("PingMaker", function() {
213213
sendIfEmpty: true,
214214
});
215215

216-
await PingMaker.collectAndStorePing("ident", ping);
216+
await PingMaker.collectAndStorePing(Glean.metricsDatabase, Glean.eventsDatabase, Glean.pingsDatabase, Glean.applicationId!, "ident", ping, undefined, Glean.debugOptions);
217217

218218
const recordedPings = await Glean.pingsDatabase.getAllPings();
219219
assert.ok(!("ident" in recordedPings));

glean/tests/core/upload/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function fillUpPingsDatabase(numPings: number): Promise<string[]> {
3131

3232
const identifiers = Array.from({ length: numPings }, () => UUIDv4());
3333
for (const identifier of identifiers) {
34-
await collectAndStorePing(identifier, ping);
34+
await collectAndStorePing(Glean.metricsDatabase, Glean.eventsDatabase, Glean.pingsDatabase, Glean.applicationId!, identifier, ping);
3535
}
3636

3737
return identifiers;

0 commit comments

Comments
 (0)