mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	chore: add more logging if test-db destroy fails
This commit is contained in:
		
							parent
							
								
									8d63e7e7f5
								
							
						
					
					
						commit
						3e4ab827d3
					
				@ -54,8 +54,8 @@ module.exports = async function init(databaseSchema = 'test', getLogger) {
 | 
				
			|||||||
    const options = {
 | 
					    const options = {
 | 
				
			||||||
        databaseUrl: require('./database-config').getDatabaseUrl(),
 | 
					        databaseUrl: require('./database-config').getDatabaseUrl(),
 | 
				
			||||||
        databaseSchema,
 | 
					        databaseSchema,
 | 
				
			||||||
        minPool: 1,
 | 
					        minPool: 0,
 | 
				
			||||||
        maxPool: 2,
 | 
					        maxPool: 1,
 | 
				
			||||||
        getLogger,
 | 
					        getLogger,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -32,7 +32,13 @@ module.exports = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            request: supertest.agent(app),
 | 
					            request: supertest.agent(app),
 | 
				
			||||||
            destroy: () => stores.db.destroy(),
 | 
					            destroy: async () => {
 | 
				
			||||||
 | 
					                try {
 | 
				
			||||||
 | 
					                    await stores.db.destroy();
 | 
				
			||||||
 | 
					                } catch (error) {
 | 
				
			||||||
 | 
					                    console.error('Failed to destroy db', error);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    async setupAppWithAuth(name) {
 | 
					    async setupAppWithAuth(name) {
 | 
				
			||||||
@ -41,7 +47,13 @@ module.exports = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            request: supertest.agent(app),
 | 
					            request: supertest.agent(app),
 | 
				
			||||||
            destroy: () => stores.db.destroy(),
 | 
					            destroy: async () => {
 | 
				
			||||||
 | 
					                try {
 | 
				
			||||||
 | 
					                    await stores.db.destroy();
 | 
				
			||||||
 | 
					                } catch (error) {
 | 
				
			||||||
 | 
					                    console.error('Failed to destroy db', error);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -51,7 +63,13 @@ module.exports = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            request: supertest.agent(app),
 | 
					            request: supertest.agent(app),
 | 
				
			||||||
            destroy: () => stores.db.destroy(),
 | 
					            destroy: async () => {
 | 
				
			||||||
 | 
					                try {
 | 
				
			||||||
 | 
					                    await stores.db.destroy();
 | 
				
			||||||
 | 
					                } catch (error) {
 | 
				
			||||||
 | 
					                    console.error('Failed to destroy db', error);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user