Commit 01405c86 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/rpc: Use the proper Server for tests

parent 5aec3f67
...@@ -23,17 +23,15 @@ func TestUiRPC(t *testing.T) { ...@@ -23,17 +23,15 @@ func TestUiRPC(t *testing.T) {
// Create the UI to test // Create the UI to test
ui := new(testUi) ui := new(testUi)
uiServer := &UiServer{ui}
// Start the RPC server // Start the RPC server
readyChan := make(chan int) server := NewServer()
stopChan := make(chan int) server.RegisterUi(ui)
defer func() { stopChan <- 1 }() server.Start()
go testRPCServer(":1234", "Ui", uiServer, readyChan, stopChan) defer server.Stop()
<-readyChan
// Create the client over RPC and run some methods to verify it works // Create the client over RPC and run some methods to verify it works
client, err := rpc.Dial("tcp", ":1234") client, err := rpc.Dial("tcp", server.Address())
if err != nil { if err != nil {
panic(err) panic(err)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment