Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): separate test db to isolate concurrent test instances #975

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

qwqcode
Copy link
Member

@qwqcode qwqcode commented Sep 16, 2024

Through the logs of unit tests, I observed that concurrent tests often fail, which puzzled me. Initially, I thought it was due to concurrency issues and improper locking. However, further testing revealed that the problem was not with improper locking but with the shared database and its data among these test instances. This led to dirty data being read during concurrent testing. The design did not originally consider distributed deployment, and without database-level or distributed locks, multiple instances should not access the same database simultaneously. This PR modifies the approach to create a separate, isolated database for each test instance by calling the NewTestApp function, preventing the issues mentioned above.

@qwqcode qwqcode merged commit 4bd3537 into master Sep 16, 2024
6 of 7 checks passed
@qwqcode qwqcode deleted the fix/test branch September 16, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant