Skip to content

Re-seeding database between tests #712

Closed Answered by robinelvin
robinelvin asked this question in Q&A
Discussion options

You must be logged in to vote

After reading Demystifying ‘Waiting for table metadata lock’ in mysql 5.7
I was able to trace the issue to an open transaction with one of my queries triggered by one of my tests. When I fixed my code to commit this transaction I was able to get my tests passing perfectly.

For information here is my GraphQL mutation resolver which I use to trigger a database reset between tests:

@Resolver()
export class TestsResolver {
    private _logger: LoggingService;

    private get logger(): LoggingService {
        if (this._logger === undefined) {
            this._logger = new LoggingService('TestsResolver');
        }
        return this._logger;
    }

    @Mutation((_returns) => TestsOperati…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by robinelvin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant