Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Add Listen Address resolver #186

Merged
merged 3 commits into from
Aug 15, 2018
Merged

Conversation

benraskin92
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Aug 15, 2018

Codecov Report

Merging #186 into master will decrease coverage by 0.27%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #186      +/-   ##
==========================================
- Coverage   78.23%   77.95%   -0.28%     
==========================================
  Files          86       87       +1     
  Lines        3542     3570      +28     
==========================================
+ Hits         2771     2783      +12     
- Misses        703      718      +15     
- Partials       68       69       +1

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 994ab32...5648c35. Read the comment docs.

@@ -0,0 +1,97 @@
// Copyright (c) 2018 Uber Technologies, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: change the package name to listenadress

PortType Resolver `yaml:"portType" validate:"nonzero"`

// Value is the config specified port if using config port type.
Value *string `yaml:"value"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you make this an int?

}
p := c.Port

var port string
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: make this an int

err := fmt.Errorf("missing port env var value using: resolver=%s, name=%s",
string(p.PortType), *p.EnvVarName)
return "", err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ensure the port is a valid int (do the Atoi) after getting it here.

Copy link
Contributor

@prateek prateek left a comment

Choose a reason for hiding this comment

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

LGTM w/ a few nits

hostname = "0.0.0.0"
)

func TestListenAddressResolver(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.

nit: Can you convert these to tabled tests since they're hitting the same function?

)

var (
port = "9000"
Copy link
Contributor

Choose a reason for hiding this comment

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

Add in a test for invalid (<0,>2^16) and non-alpha ports?

Copy link
Contributor

@prateek prateek left a comment

Choose a reason for hiding this comment

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

LGTM +2

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.

3 participants