Skip to content

Commit 88e4454

Browse files
committed
Fix flaky postgres test
1 parent c4aadc9 commit 88e4454

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/PostgresStorageAdapter.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe_only_db('postgres')('PostgresStorageAdapter', () => {
165165
]);
166166
//Postgres won't take advantage of the index until it has a lot of records because sequential is faster for small db's
167167
await client.none(
168-
'INSERT INTO $1:name ($2:name, $3:name) SELECT MD5(random()::text), MD5(random()::text) FROM generate_series(1,5000)',
168+
'INSERT INTO $1:name ($2:name, $3:name) SELECT gen_random_uuid(), gen_random_uuid() FROM generate_series(1,5000)',
169169
[tableName, 'objectId', 'username']
170170
);
171171
const caseInsensitiveData = 'bugs';
@@ -245,7 +245,7 @@ describe_only_db('postgres')('PostgresStorageAdapter', () => {
245245
//Postgres won't take advantage of the index until it has a lot of records because sequential is faster for small db's
246246
const client = adapter._client;
247247
await client.none(
248-
'INSERT INTO $1:name ($2:name, $3:name) SELECT MD5(random()::text), MD5(random()::text) FROM generate_series(1,5000)',
248+
'INSERT INTO $1:name ($2:name, $3:name) SELECT gen_random_uuid(), gen_random_uuid() FROM generate_series(1,5000)',
249249
[tableName, 'objectId', 'username']
250250
);
251251
const caseInsensitiveData = 'bugs';
@@ -303,7 +303,7 @@ describe_only_db('postgres')('PostgresStorageAdapter', () => {
303303
//Postgres won't take advantage of the index until it has a lot of records because sequential is faster for small db's
304304
const client = adapter._client;
305305
await client.none(
306-
'INSERT INTO $1:name ($2:name, $3:name) SELECT MD5(random()::text), MD5(random()::text) FROM generate_series(1,5000)',
306+
'INSERT INTO $1:name ($2:name, $3:name) SELECT gen_random_uuid(), gen_random_uuid() FROM generate_series(1,5000)',
307307
[tableName, 'objectId', 'username']
308308
);
309309

@@ -345,11 +345,11 @@ describe_only_db('postgres')('PostgresStorageAdapter', () => {
345345
//Postgres won't take advantage of the index until it has a lot of records because sequential is faster for small db's
346346
const client = adapter._client;
347347
await client.none(
348-
'INSERT INTO $1:name ($2:name, $3:name) SELECT MD5(random()::text), MD5(random()::text) FROM generate_series(1,5000)',
348+
'INSERT INTO $1:name ($2:name, $3:name) SELECT gen_random_uuid(), gen_random_uuid() FROM generate_series(1,5000)',
349349
[firstTableName, 'objectId', uniqueField]
350350
);
351351
await client.none(
352-
'INSERT INTO $1:name ($2:name, $3:name) SELECT MD5(random()::text), MD5(random()::text) FROM generate_series(1,5000)',
352+
'INSERT INTO $1:name ($2:name, $3:name) SELECT gen_random_uuid(), gen_random_uuid() FROM generate_series(1,5000)',
353353
[secondTableName, 'objectId', uniqueField]
354354
);
355355

0 commit comments

Comments
 (0)