-
Type:
Improvement
-
Resolution: Won't Do
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Testing
-
None
-
🔵 Done
-
Go Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Context
Currently almost all integration tests (e.g. tests that use mtest) are in the "internal/integration" directory rather in the directory with the code they test. Conventionally, Go tests are in the same package or directory as the code they test. Additionally, separating them creates filename collisions (e.g. client_test.go exists in two places), making it more difficult to quickly identify test files.
In order to import mtest, tests cannot be in the mongo package because it creates an import cycle. However, we can move the test files to the same directory and use the [package]_test package name.
Definition of done
- Move files from the "internal/integration" directory into the directory where the code they test lives.
- Rename all files from "[file]_test.go" to "[file]_integ_test.go"
- Rename the package from "package [package]" to "package [package]_test".
Pitfalls
- Will create large diffs and potentially lose history, depending on how the move is done. Maybe that makes it not worth doing?
- How do we move the files without losing the git history?