File tree Expand file tree Collapse file tree 3 files changed +35
-13
lines changed Expand file tree Collapse file tree 3 files changed +35
-13
lines changed Original file line number Diff line number Diff line change 1+ import test from "ava"
2+ import pRetry from "p-retry"
3+ import { getTestPostgresDatabaseFactory } from "~/index"
4+
5+ const getTestServer = getTestPostgresDatabaseFactory ( {
6+ postgresVersion : process . env . POSTGRES_VERSION ,
7+ } )
8+
9+ const NUM_OF_DEFAULT_POSTGRES_DATABASES = 1
10+
11+ test ( "database that first test worker created should have been dropped" , async ( t ) => {
12+ const { pool } = await getTestServer ( t )
13+
14+ await pRetry (
15+ async ( ) => {
16+ const {
17+ rows : [ { count } ] ,
18+ } = await pool . query (
19+ 'SELECT COUNT(*) FROM "pg_database" WHERE "datistemplate" = false'
20+ )
21+
22+ // (Add one since we create a database in this test)
23+ if ( Number ( count ) !== NUM_OF_DEFAULT_POSTGRES_DATABASES + 1 ) {
24+ throw new Error ( "Database was not dropped" )
25+ }
26+ } ,
27+ {
28+ minTimeout : 100 ,
29+ factor : 1 ,
30+ maxRetryTime : 30_000 ,
31+ }
32+ )
33+
34+ t . pass ( )
35+ } )
Original file line number Diff line number Diff line change 11import test from "ava"
22import { getTestPostgresDatabaseFactory } from "~/index"
33import { countDatabaseTemplates } from "./utils/count-database-templates"
4- import { doesDatabaseExist } from "./utils/does-database-exist"
54
65test ( "beforeTemplateIsBaked" , async ( t ) => {
76 let wasHookCalled = false
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments