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

feat(pkger): extend pkgs with source identifiers #18515

Merged
merged 3 commits into from
Jun 16, 2020

Conversation

jsteenb2
Copy link
Contributor

@jsteenb2 jsteenb2 commented Jun 15, 2020

a good chunk of this PR is jiggling some bits to remove the high lvl Pkg from the svc interface.

references: #18243

TODOs
  • add tests around different source types in Parser
  • add assertions to pkger_test.go
  • extend stack with sources
  • ensure API is backwards compatible (when OSS beta13 is released, we can let the axe split)

@jsteenb2 jsteenb2 requested a review from a team as a code owner June 15, 2020 20:25
@jsteenb2 jsteenb2 requested review from imogenkinsman, hoorayimhelping and bthesorceror and removed request for a team June 15, 2020 20:25
@jsteenb2 jsteenb2 force-pushed the 18243/pkger_file_source branch 2 times, most recently from ecbbe90 to b71e264 Compare June 16, 2020 01:04
@jsteenb2 jsteenb2 requested a review from a team as a code owner June 16, 2020 01:04
@jsteenb2 jsteenb2 force-pushed the 18243/pkger_file_source branch 4 times, most recently from bfd4fbe to 51c4b35 Compare June 16, 2020 03:49
@jsteenb2 jsteenb2 removed request for imogenkinsman and a team June 16, 2020 03:54
@jsteenb2 jsteenb2 changed the title chore(pkger): extend pkgs with source identifier feat(pkger): extend pkgs with source identifier Jun 16, 2020
@jsteenb2 jsteenb2 changed the title feat(pkger): extend pkgs with source identifier feat(pkger): extend pkgs with source identifiers Jun 16, 2020
func (s *HTTPRemoteService) DryRun(ctx context.Context, orgID, userID influxdb.ID, pkg *Pkg, opts ...ApplyOptFn) (PkgImpactSummary, error) {
return s.apply(ctx, orgID, pkg, true, opts...)
func (s *HTTPRemoteService) DryRun(ctx context.Context, orgID, userID influxdb.ID, opts ...ApplyOptFn) (PkgImpactSummary, error) {
return s.apply(ctx, orgID, true, opts...)
Copy link
Contributor

Choose a reason for hiding this comment

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

not a blocker for this, but a design consideration to have a think about:

boolean arguments trigger me hard because they provide very little context to what's happening. i assume true and false passed in to apply have to do with dry runs, but that is a wild ass guess that required looking around at the context of these calls to even have an idea. point is, boolean arguments are a kind of hard stop on comprehension and require digging into definitions to understand.

i think it's usually worth considering how the intent of this true vs false value might be captured in a way that gives context to the reader. making it an enum is one way i can think of that doesn't resort to stringly typed stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hear you, if it were exported, I'd have addressed it. However, it's internal, and don't see it necessary here.

@@ -584,6 +625,21 @@ func pkgEncoding(contentType string) Encoding {
}
}

func convertEncoding(ct, rawURL string) Encoding {
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, it's hard for me to tell but is this unit tested? it seems like a prime candidate for unit tests hitting all the branches in the switch statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not explicitly, its an internal implementation detail. Is tested in other tests that rely on this. It is purposeful that there is very limited white box testing in pkger.

@jsteenb2 jsteenb2 merged commit b977568 into master Jun 16, 2020
@jsteenb2 jsteenb2 deleted the 18243/pkger_file_source branch June 16, 2020 15:04
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.

2 participants