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

internal/timeout: extract package for handling timeouts #2698

Merged
merged 8 commits into from Jul 22, 2020

Conversation

skriss
Copy link
Member

@skriss skriss commented Jul 17, 2020

WIP, let me know if this makes sense. I got sick of keeping track of what -1, 0, "", and "infinity" meant between Contour and Envoy so added a proper type for it.

If this makes sense, then we can use the same package for processing the config file timeout values so the syntax is consistent everywhere.

Updates #2697

@jpeach
Copy link
Contributor

jpeach commented Jul 17, 2020

@skriss I think this makes a lot of sense and is a great improvement. I'd like to do a full review next week.

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

Overall, LGTM, except for one naming thing.

internal/timeout/timeout.go Outdated Show resolved Hide resolved
@skriss skriss marked this pull request as ready for review July 20, 2020 22:08
Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

LGTM, nice work.

Copy link
Contributor

@jpeach jpeach left a comment

Choose a reason for hiding this comment

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

I like this a lot.

internal/timeout/timeout.go Outdated Show resolved Hide resolved
internal/timeout/timeout.go Outdated Show resolved Hide resolved
internal/timeout/timeout_test.go Outdated Show resolved Hide resolved
got := Parse(tc.duration)
if tc.want != got {
t.Errorf("Wanted %v, got %v", tc.want, got)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Arguably a matter of taste, but I'd be inclined to test this like this:

assert.Equal(Parse(""), DefaultSetting())
assert.Equal(Parse("0"), DefaultSetting())

I'm also OK if you want to leave this as it is.

internal/timeout/timeout.go Show resolved Hide resolved
internal/envoy/route.go Outdated Show resolved Hide resolved
internal/envoy/route.go Outdated Show resolved Hide resolved
internal/envoy/route.go Outdated Show resolved Hide resolved
internal/dag/policy.go Show resolved Hide resolved
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
@skriss
Copy link
Member Author

skriss commented Jul 21, 2020

Rebased to address merge conflicts.

@codecov
Copy link

codecov bot commented Jul 21, 2020

Codecov Report

Merging #2698 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2698      +/-   ##
==========================================
+ Coverage   76.85%   76.88%   +0.03%     
==========================================
  Files          72       72              
  Lines        5702     5711       +9     
==========================================
+ Hits         4382     4391       +9     
  Misses       1228     1228              
  Partials       92       92              
Impacted Files Coverage Δ
internal/dag/dag.go 93.82% <ø> (ø)
internal/annotation/annotations.go 100.00% <100.00%> (ø)
internal/assert/assert.go 75.00% <100.00%> (ø)
internal/dag/policy.go 95.93% <100.00%> (+0.20%) ⬆️
internal/envoy/route.go 98.38% <100.00%> (-0.08%) ⬇️
internal/timeout/timeout.go 100.00% <100.00%> (ø)

Copy link
Contributor

@jpeach jpeach left a comment

Choose a reason for hiding this comment

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

Looks great.

@skriss skriss merged commit 2d36cc8 into projectcontour:master Jul 22, 2020
@skriss skriss deleted the refactor-timeouts branch July 22, 2020 15:54
tthebst pushed a commit to tthebst/contour that referenced this pull request Aug 6, 2020
…ur#2698)

Adds the internal/timeout package, which exposes a structured
type for representing timeouts, and updates existing code to use
this new package.

Signed-off-by: Steve Kriss <krisss@vmware.com>
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.

None yet

4 participants