Skip to content

Commit 69aba3b

Browse files
authored
ci: Fix Postgres flaky tests (#9217)
1 parent 16f3150 commit 69aba3b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spec/batch.spec.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,11 @@ describe('batch', () => {
368368
it('should generate separate session for each call', async () => {
369369
await reconfigureServer();
370370
const myObject = new Parse.Object('MyObject'); // This is important because transaction only works on pre-existing collections
371-
await myObject.save();
371+
await myObject.save({ key: 'stringField' });
372372
await myObject.destroy();
373373

374374
const myObject2 = new Parse.Object('MyObject2'); // This is important because transaction only works on pre-existing collections
375-
await myObject2.save();
375+
await myObject2.save({ key: 'stringField' });
376376
await myObject2.destroy();
377377
createSpy.calls.reset();
378378

@@ -381,6 +381,7 @@ describe('batch', () => {
381381
myObjectCalls++;
382382
if (myObjectCalls === 2) {
383383
try {
384+
// Saving a number to a string field should fail
384385
await request({
385386
method: 'POST',
386387
headers: headers,
@@ -547,14 +548,14 @@ describe('batch', () => {
547548
const results3 = await query3.find();
548549
expect(results3.map(result => result.get('key')).sort()).toEqual(['value1', 'value2']);
549550

550-
expect(databaseAdapter.createObject.calls.count() >= 13).toEqual(true);
551+
expect(createSpy.calls.count() >= 13).toEqual(true);
551552
let transactionalSession;
552553
let transactionalSession2;
553554
let myObjectDBCalls = 0;
554555
let myObject2DBCalls = 0;
555556
let myObject3DBCalls = 0;
556-
for (let i = 0; i < databaseAdapter.createObject.calls.count(); i++) {
557-
const args = databaseAdapter.createObject.calls.argsFor(i);
557+
for (let i = 0; i < createSpy.calls.count(); i++) {
558+
const args = createSpy.calls.argsFor(i);
558559
switch (args[0]) {
559560
case 'MyObject':
560561
myObjectDBCalls++;

0 commit comments

Comments
 (0)