mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Added server ping timer test
This commit is contained in:
33
server/ping_test.go
Normal file
33
server/ping_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright 2015 Apcera Inc. All rights reserved.
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/apcera/nats"
|
||||
)
|
||||
|
||||
const PING_CLIENT_PORT = 11228
|
||||
|
||||
var DefaultPingOptions = Options{
|
||||
Host: "localhost",
|
||||
Port: PING_CLIENT_PORT,
|
||||
NoLog: true,
|
||||
NoSigs: true,
|
||||
PingInterval: 5 * time.Millisecond,
|
||||
}
|
||||
|
||||
func TestPing(t *testing.T) {
|
||||
s := RunServer(&DefaultPingOptions)
|
||||
defer s.Shutdown()
|
||||
|
||||
nc, err := nats.Connect(fmt.Sprintf("nats://localhost:%d", PING_CLIENT_PORT))
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating client: %v\n", err)
|
||||
}
|
||||
defer nc.Close()
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
Reference in New Issue
Block a user