Merge lp:~thumper/juju-core/client-test-no-fixed-port into lp:~go-bot/juju-core/trunk
Proposed by
Tim Penhey
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2525 |
Proposed branch: | lp:~thumper/juju-core/client-test-no-fixed-port |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
35 lines (+7/-3) 1 file modified
state/api/client_test.go (+7/-3) |
To merge this branch: | bzr merge lp:~thumper/juju-core/client-test-no-fixed-port |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+213582@code.launchpad.net |
Commit message
Make the test not use a fixed port.
Simple change to avoid a fixed port in the test.
Description of the change
Make the test not use a fixed port.
Simple change to avoid a fixed port in the test.
To post a comment you must log in.
Reviewers: mp+213582_ code.launchpad. net,
Message:
Please take a look.
Description:
Make the test not use a fixed port.
Simple change to avoid a fixed port in the test.
https:/ /code.launchpad .net/~thumper/ juju-core/ client- test-no- fixed-port/ +merge/ 213582
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/82940044/
Affected files (+9, -2 lines): client_ test.go
A [revision details]
M state/api/
Index: [revision details] 20140331192817- ytfa2vb3oz21cj4 e
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: state/api/ client_ test.go api/client_ test.go' client_ test.go 2014-03-13 07:54:56 +0000 client_ test.go 2014-04-01 04:30:11 +0000
=== modified file 'state/
--- state/api/
+++ state/api/
@@ -5,6 +5,7 @@
import (
"fmt"
+ "net"
"net/http"
jc "github. com/juju/ testing/ checkers" ).(*net. TCPAddr) .Port localhost:%d", port) HandleFunc( "/charms" , func(w http.ResponseWr iter, r *http.Request) { odNotAllowed) erve(": 8900", nil)
@@ -65,17 +66,21 @@
// Finally, try the NotImplementedError by mocking the server
// address to a handler that returns 405 Method Not Allowed for
// POST.
+ lis, err := net.Listen("tcp", ":0")
+ c.Assert(err, gc.IsNil)
+ port := lis.Addr(
+ url := fmt.Sprintf("http://
http.
if r.Method == "POST" {
http.Error(w, "Method Not Allowed", http.StatusMeth
}
})
go func() {
- err = http.ListenAndS
+ err = http.Serve(lis, nil)
c.Assert(err, gc.IsNil)
}()
- api.SetServerRo ot(client, "http:// localhost: 8900") ot(client, url) AddLocalCharm( curl, charmArchive) IsCodeNotImplem ented)
+ api.SetServerRo
_, err = client.
c.Assert(err, jc.Satisfies, params.
}