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

Divest api/ package of deps elsewhere in the nomad repo. #5488

Merged
merged 4 commits into from
Mar 29, 2019

Conversation

jefferai
Copy link
Member

This will allow making api/ a module without then pulling in the
external repo, leading to a package name conflict.

This required some migration of tests to an apitests/ folder (can be
moved anywhere as it has no deps on it). It also required some
duplication of code, notably some test helpers from api/ -> apitests/
and part (but not all) of testutil/ -> api/testutil/.

Once there's more separation and an e.g. sdk/ folder those can be
removed in favor of a dep on the sdk/ folder, provided the sdk/ folder
doesn't depend on api/ or /.

This will allow making api/ a module without then pulling in the
external repo, leading to a package name conflict.

This required some migration of tests to an apitests/ folder (can be
moved anywhere as it has no deps on it). It also required some
duplication of code, notably some test helpers from api/ -> apitests/
and part (but not all) of testutil/ -> api/testutil/.

Once there's more separation and an e.g. sdk/ folder those can be
removed in favor of a dep on the sdk/ folder, provided the sdk/ folder
doesn't depend on api/ or /.
Copy link
Contributor

@notnoop notnoop left a comment

Choose a reason for hiding this comment

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

Approach lgtm, and testutil duplication seems fine and we have that pattern elsewhere too for API package (for structs), and we can clean up with the sdk later on without impacting users.

Also, should api/testutil packages be moved to internal namespace (e.g. api/internal/testutil? Avoids leaking tests in public API and allows us to move packages around without affecting users.

lgtm, but would be nice to have a second review too (@schmichael ?), for awareness and just I missed anything.

@@ -7,7 +7,7 @@ import (

"time"

"github.com/hashicorp/nomad/helper/uuid"
Copy link
Contributor

Choose a reason for hiding this comment

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

In a follow-up PR, I'll nuke helper/uuid for hashicorp/go-uuid? Given that we already depend on go-uuid (as showed by vendor file), it doesn't make sense to have our own helper package.

@@ -46,43 +44,6 @@ func TestJobs_Register(t *testing.T) {
}
}

func TestJobs_Parse(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

to call it out for future reviews, this and many removed tests were moved to apitests/

Copy link
Contributor

@notnoop notnoop left a comment

Choose a reason for hiding this comment

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

Looks good. Confirmed only test files are changed, the uuid modification is minor:

$ git diff --name-only 7feee07d8f353f4bc83a19d25bb6906ed98edb0c | grep -v -e _test.go -e api/internal
vendor/github.com/hashicorp/go-uuid/README.md
vendor/github.com/hashicorp/go-uuid/go.mod
vendor/github.com/hashicorp/go-uuid/uuid.go
vendor/vendor.json

@jefferai jefferai merged commit 5676986 into master Mar 29, 2019
@jefferai jefferai deleted the remove-api-deps branch March 29, 2019 18:47
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants