From 01405c864b6a133cd33c8477ff056dafe41b86ee Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 4 May 2013 19:59:34 -0700 Subject: [PATCH] packer/rpc: Use the proper Server for tests --- packer/rpc/ui_test.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packer/rpc/ui_test.go b/packer/rpc/ui_test.go index 7975d0217..f70e9a587 100644 --- a/packer/rpc/ui_test.go +++ b/packer/rpc/ui_test.go @@ -23,17 +23,15 @@ func TestUiRPC(t *testing.T) { // Create the UI to test ui := new(testUi) - uiServer := &UiServer{ui} // Start the RPC server - readyChan := make(chan int) - stopChan := make(chan int) - defer func() { stopChan <- 1 }() - go testRPCServer(":1234", "Ui", uiServer, readyChan, stopChan) - <-readyChan + server := NewServer() + server.RegisterUi(ui) + server.Start() + defer server.Stop() // 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 { panic(err) }