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

Move all tests to a separate module to reduce dependencies #72

Merged
merged 4 commits into from
Mar 11, 2025

Conversation

Yiling-J
Copy link
Collaborator

@Yiling-J Yiling-J commented Mar 6, 2025

Fixes #71

This PR moves all tests to a new module called tests, reducing dependencies in the main module. Additionally, it includes the following updates:

  • Creates a Go workspace.
  • Updates the Makefile test command to cd into the tests folder first.
  • Updates the CI lint step to check both the txdb and tests modules. This step is a little tricky, but fortunately, golangci-lint-action provides an example.
  • Updates the CI test step to use ./tests as working-directory.

To verify:

  • I confirmed that the lint CI works by manually introducing errors in db.go and tests/db_test.go.
  • I confirmed running go test in tests module will use the db.go file in parent directory by manually introducing error in db.go:
go-txdb % cd tests
tests % go test ./...
# github.com/DATA-DOG/go-txdb
../db.go:175:2: declared and not used: z
FAIL	github.com/DATA-DOG/go-txdb/tests [build failed]
FAIL
  • I verified that running go get github.com/DATA-DOG/go-txdb@d837e05 results in the following go.mod:
module foo

go 1.24.0

require github.com/DATA-DOG/go-txdb v0.2.1-0.20250306135245-d837e056a55c

@Yiling-J Yiling-J requested a review from flimzy March 6, 2025 14:19
@Yiling-J Yiling-J self-assigned this Mar 6, 2025
Copy link
Collaborator

@flimzy flimzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great solution! Thanks!

@Yiling-J Yiling-J merged commit 7087aa8 into master Mar 11, 2025
10 checks passed
@Yiling-J
Copy link
Collaborator Author

@flimzy I think we can release a new version

@flimzy flimzy deleted the refactor/test_containers_module branch March 11, 2025 14:28
@flimzy
Copy link
Collaborator

flimzy commented Mar 11, 2025

@flimzy I think we can release a new version

Done: https://github.com/DATA-DOG/go-txdb/releases/tag/v0.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce dependencies
2 participants