okuda-seminar / log_service

Apache License 2.0
0 stars 0 forks source link

[Server] Improve Test Cleanup Phase to Ensure Proper Test Isolation #18

Open Rwatana opened 2 months ago

Rwatana commented 2 months ago

Summary

The current test implementation for the repository layer does not provide sufficient cleanup in the Cleanup phase. This causes data from previous tests to persist, which leads to unexpected results and failures when subsequent tests are executed. Proper test isolation is crucial to ensuring that each test can run independently without being affected by the state of other tests. This issue aims to refactor the tests by enhancing the Cleanup phase and ensuring that no test data persists after each test execution.

Goal

This issue will be considered closed when the following conditions are met:

  1. Enhanced Cleanup Phase:

    • Each test's Cleanup phase properly removes all test data and reinitializes the database state, ensuring no residual data from previous tests.
  2. Test Isolation:

    • Each test can be executed independently without interference from other tests.
  3. Verification of Correctness:

    • All existing tests pass successfully after the refactor with proper cleanup and isolation.

Todo

Deadline

10/7

References

https://qiita.com/ppco/items/2a7af591eaf08bdf9406 https://github.com/okuda-seminar/X-Clone-Backend/blob/main/api/handlers/setup_test.go