Beispiel #1
0
func createSocketServer(t *testing.T) (string, net.Listener) {
	socketFile := tt.TempFile(t)
	tt.TestExpectSuccess(t, os.Remove(socketFile))

	l, err := net.Listen("unix", socketFile)
	tt.TestExpectSuccess(t, err)

	return socketFile, l
}
Beispiel #2
0
func TestClient_WaitForSocket(t *testing.T) {
	tt.StartTest(t)
	defer tt.FinishTest(t)

	socketFile := tt.TempFile(t)
	tt.TestExpectSuccess(t, os.Remove(socketFile))

	client := New(socketFile)
	err := client.WaitForSocket(10 * time.Millisecond)
	tt.TestExpectError(t, err)

	f, err := os.Create(socketFile)
	tt.TestExpectSuccess(t, err)
	f.Close()

	err = client.WaitForSocket(10 * time.Millisecond)
	tt.TestExpectSuccess(t, err)
}