mirror of
https://github.com/golang/go
synced 2024-11-19 21:54:40 -07:00
rpc: use httptest.Server for tests
R=golang-dev, rsc1, rsc CC=golang-dev https://golang.org/cl/4253060
This commit is contained in:
parent
c6093e6b82
commit
c7ef0fd26b
@ -6,7 +6,7 @@ package rpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"http"
|
"http/httptest"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
@ -103,11 +103,9 @@ func startNewServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func startHttpServer() {
|
func startHttpServer() {
|
||||||
var l net.Listener
|
server := httptest.NewServer(nil)
|
||||||
l, httpServerAddr = listenTCP()
|
httpServerAddr = server.Listener.Addr().String()
|
||||||
httpServerAddr = l.Addr().String()
|
|
||||||
log.Println("Test HTTP RPC server listening on", httpServerAddr)
|
log.Println("Test HTTP RPC server listening on", httpServerAddr)
|
||||||
go http.Serve(l, nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRPC(t *testing.T) {
|
func TestRPC(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user