Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(44)

Issue 7423045: local: fix port conflict in test (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by TheMue
Modified:
10 years, 10 months ago
Reviewers:
gz, mp+151022, dave, dimitern
Visibility:
Public.

Description

local: fix port conflict in test Starting and stopping the listener during the test may lead to port conflicts. Using two functions for getting a new one and retrieving the actual one avoids this failure. https://code.launchpad.net/~themue/juju-core/015-fix-local-storage-port/+merge/151022 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : local: fix port conflict in test #

Total comments: 8

Patch Set 3 : local: fix port conflict in test #

Total comments: 2

Patch Set 4 : local: fix port conflict in test #

Total comments: 3

Patch Set 5 : local: fix port conflict in test #

Patch Set 6 : local: fix port conflict in test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -28 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M environs/local/backend_test.go View 1 2 3 4 7 chunks +38 lines, -21 lines 0 comments Download
M environs/local/storage_test.go View 1 2 2 chunks +3 lines, -7 lines 0 comments Download

Messages

Total messages: 11
TheMue
Please take a look.
11 years, 2 months ago (2013-02-28 13:50:27 UTC) #1
TheMue
Please take a look.
11 years, 2 months ago (2013-02-28 14:26:10 UTC) #2
dimitern
LGTM modulo the below. https://codereview.appspot.com/7423045/diff/3001/environs/local/backend_test.go File environs/local/backend_test.go (right): https://codereview.appspot.com/7423045/diff/3001/environs/local/backend_test.go#newcode113 environs/local/backend_test.go:113: portNo := nextPortNo() This code ...
11 years, 2 months ago (2013-02-28 15:10:42 UTC) #3
TheMue
Please take a look. https://codereview.appspot.com/7423045/diff/3001/environs/local/backend_test.go File environs/local/backend_test.go (right): https://codereview.appspot.com/7423045/diff/3001/environs/local/backend_test.go#newcode113 environs/local/backend_test.go:113: portNo := nextPortNo() On 2013/02/28 ...
11 years, 2 months ago (2013-02-28 16:51:53 UTC) #4
dimitern
Thank you, LGTM. https://codereview.appspot.com/7423045/diff/7001/environs/local/backend_test.go File environs/local/backend_test.go (right): https://codereview.appspot.com/7423045/diff/7001/environs/local/backend_test.go#newcode34 environs/local/backend_test.go:34: // nextTestSet returns a new port ...
11 years, 2 months ago (2013-02-28 16:54:03 UTC) #5
gz
This is an improvement if it makes the tests pass more, but seems like this ...
11 years, 2 months ago (2013-03-08 15:22:55 UTC) #6
TheMue
Please take a look.
11 years, 2 months ago (2013-03-08 16:27:38 UTC) #7
gz
LGTM with one minor tidy up. https://codereview.appspot.com/7423045/diff/12001/environs/local/backend_test.go File environs/local/backend_test.go (right): https://codereview.appspot.com/7423045/diff/12001/environs/local/backend_test.go#newcode43 environs/local/backend_test.go:43: c.Assert(err, IsNil) In ...
11 years, 2 months ago (2013-03-08 16:51:55 UTC) #8
TheMue
Please take a look.
11 years, 2 months ago (2013-03-08 17:36:31 UTC) #9
TheMue
*** Submitted: local: fix port conflict in test Starting and stopping the listener during the ...
11 years, 2 months ago (2013-03-08 19:09:32 UTC) #10
dave_cheney.net
11 years, 2 months ago (2013-03-08 19:42:58 UTC) #11
I'd like to see all the string mangling replaced with net.Listener and net.Addr
types. Otherwise it looks pretty good too me.

https://codereview.appspot.com/7423045/diff/12001/environs/local/backend_test.go
File environs/local/backend_test.go (right):

https://codereview.appspot.com/7423045/diff/12001/environs/local/backend_test...
environs/local/backend_test.go:40: _, ports, err :=
net.SplitHostPort(listener.Addr().String())
if local.Listen returns a net.Listener which we know is a *net.TCPListener, then
you can make this simpler by saying

port := listener.Addr().(*net.TCPAddr).Port

https://codereview.appspot.com/7423045/diff/12001/environs/local/storage_test.go
File environs/local/storage_test.go (right):

https://codereview.appspot.com/7423045/diff/12001/environs/local/storage_test...
environs/local/storage_test.go:22: storage := local.NewStorage("127.0.0.1",
portNo)
why does NewStorage not take a net.Addr ?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b