From 69aba3bd3be79226532205c4ac73925fdf264baa Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Wed, 17 Jul 2024 12:28:09 -0500 Subject: [PATCH] ci: Fix Postgres flaky tests (#9217) --- spec/batch.spec.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spec/batch.spec.js b/spec/batch.spec.js index 2a2be68d5b..8c9ef27a6b 100644 --- a/spec/batch.spec.js +++ b/spec/batch.spec.js @@ -368,11 +368,11 @@ describe('batch', () => { it('should generate separate session for each call', async () => { await reconfigureServer(); const myObject = new Parse.Object('MyObject'); // This is important because transaction only works on pre-existing collections - await myObject.save(); + await myObject.save({ key: 'stringField' }); await myObject.destroy(); const myObject2 = new Parse.Object('MyObject2'); // This is important because transaction only works on pre-existing collections - await myObject2.save(); + await myObject2.save({ key: 'stringField' }); await myObject2.destroy(); createSpy.calls.reset(); @@ -381,6 +381,7 @@ describe('batch', () => { myObjectCalls++; if (myObjectCalls === 2) { try { + // Saving a number to a string field should fail await request({ method: 'POST', headers: headers, @@ -547,14 +548,14 @@ describe('batch', () => { const results3 = await query3.find(); expect(results3.map(result => result.get('key')).sort()).toEqual(['value1', 'value2']); - expect(databaseAdapter.createObject.calls.count() >= 13).toEqual(true); + expect(createSpy.calls.count() >= 13).toEqual(true); let transactionalSession; let transactionalSession2; let myObjectDBCalls = 0; let myObject2DBCalls = 0; let myObject3DBCalls = 0; - for (let i = 0; i < databaseAdapter.createObject.calls.count(); i++) { - const args = databaseAdapter.createObject.calls.argsFor(i); + for (let i = 0; i < createSpy.calls.count(); i++) { + const args = createSpy.calls.argsFor(i); switch (args[0]) { case 'MyObject': myObjectDBCalls++;