jsonrpc: ws addresses in tests
This commit is contained in:
parent
96ed4225fb
commit
b93d71e8cb
@ -62,7 +62,6 @@ func TestRPC(t *testing.T) {
|
|||||||
// httptest stuff
|
// httptest stuff
|
||||||
testServ := httptest.NewServer(rpcServer)
|
testServ := httptest.NewServer(rpcServer)
|
||||||
defer testServ.Close()
|
defer testServ.Close()
|
||||||
|
|
||||||
// setup client
|
// setup client
|
||||||
|
|
||||||
var client struct {
|
var client struct {
|
||||||
@ -70,7 +69,7 @@ func TestRPC(t *testing.T) {
|
|||||||
AddGet func(int) int
|
AddGet func(int) int
|
||||||
StringMatch func(t TestType, i2 int64) (out TestOut, err error)
|
StringMatch func(t TestType, i2 int64) (out TestOut, err error)
|
||||||
}
|
}
|
||||||
closer, err := NewClient(testServ.URL, "SimpleServerHandler", &client)
|
closer, err := NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -133,7 +132,7 @@ func TestRPC(t *testing.T) {
|
|||||||
var noret struct {
|
var noret struct {
|
||||||
Add func(int)
|
Add func(int)
|
||||||
}
|
}
|
||||||
closer, err = NewClient(testServ.URL, "SimpleServerHandler", &noret)
|
closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &noret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -148,7 +147,7 @@ func TestRPC(t *testing.T) {
|
|||||||
var noparam struct {
|
var noparam struct {
|
||||||
Add func()
|
Add func()
|
||||||
}
|
}
|
||||||
closer, err = NewClient(testServ.URL, "SimpleServerHandler", &noparam)
|
closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &noparam)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -160,7 +159,7 @@ func TestRPC(t *testing.T) {
|
|||||||
var erronly struct {
|
var erronly struct {
|
||||||
AddGet func() (int, error)
|
AddGet func() (int, error)
|
||||||
}
|
}
|
||||||
closer, err = NewClient(testServ.URL, "SimpleServerHandler", &erronly)
|
closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &erronly)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -174,7 +173,7 @@ func TestRPC(t *testing.T) {
|
|||||||
var wrongtype struct {
|
var wrongtype struct {
|
||||||
Add func(string) error
|
Add func(string) error
|
||||||
}
|
}
|
||||||
closer, err = NewClient(testServ.URL, "SimpleServerHandler", &wrongtype)
|
closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", &wrongtype)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -188,7 +187,7 @@ func TestRPC(t *testing.T) {
|
|||||||
var notfound struct {
|
var notfound struct {
|
||||||
NotThere func(string) error
|
NotThere func(string) error
|
||||||
}
|
}
|
||||||
closer, err = NewClient(testServ.URL, "SimpleServerHandler", ¬found)
|
closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "SimpleServerHandler", ¬found)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -237,7 +236,7 @@ func TestCtx(t *testing.T) {
|
|||||||
var client struct {
|
var client struct {
|
||||||
Test func(ctx context.Context)
|
Test func(ctx context.Context)
|
||||||
}
|
}
|
||||||
closer, err := NewClient(testServ.URL, "CtxHandler", &client)
|
closer, err := NewClient("ws://" + testServ.Listener.Addr().String(), "CtxHandler", &client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -260,7 +259,7 @@ func TestCtx(t *testing.T) {
|
|||||||
var noCtxClient struct {
|
var noCtxClient struct {
|
||||||
Test func()
|
Test func()
|
||||||
}
|
}
|
||||||
closer, err = NewClient(testServ.URL, "CtxHandler", &noCtxClient)
|
closer, err = NewClient("ws://" + testServ.Listener.Addr().String(), "CtxHandler", &noCtxClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user