Skip to content

Split massive TestTransactionManager into smaller ones

A prerequisite extracted from !6551 (merged)

Recently, the test TestTransactionManager has been quite long with nearly ~6000 LOCs. All test cases are packed into one big test table. That makes it hard to navigate through the file. The size of the file even breaks GitLab.com's review feature.

Screenshot_2023-11-27_at_23.43.27

This MR restructures the test file so that we can split it into smaller ones. The foundational changes consist of the following:

  • Move common test structs to test helper file.
  • Generalize and extract test setup.
  • Extract scenario execution.

Afterward, the test suite is split into topics, one file per topic:

  • Reference-related tests including validation, reference modification, etc.
  • Repository-created tests including repository creation and deletion.
  • Alternate and object pool tests
  • Other tests are still located in the original file.

Of course, the boundaries between them are soft. A repository-related test can include reference verification, for example. We can re-arrange the tests if needed later.

Because transaction_manager_test.go is too big, it's not feasible to review it on GitLab.com. Here's the result before and after test refactoring. The number of tests matched, except for some new test wrappers.

Before After
Screenshot_2023-11-28_at_00.00.05 Screenshot_2023-12-06_at_14.37.37
Edited by Quang-Minh Nguyen

Merge request reports