mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Export running a test Go routine server
This commit is contained in:
12
test/test.go
12
test/test.go
@@ -28,23 +28,20 @@ type tLogger interface {
|
||||
Errorf(format string, args ...interface{})
|
||||
}
|
||||
|
||||
var defaultServerOptions = server.Options{
|
||||
var DefaultTestOptions = server.Options{
|
||||
Host: "localhost",
|
||||
Port: 4222,
|
||||
Trace: false,
|
||||
Debug: false,
|
||||
NoLog: true,
|
||||
NoSigs: true,
|
||||
}
|
||||
|
||||
func runDefaultServer() *server.Server {
|
||||
return runServer(&defaultServerOptions)
|
||||
return RunServer(&DefaultTestOptions)
|
||||
}
|
||||
|
||||
// New Go Routine based server
|
||||
func runServer(opts *server.Options) *server.Server {
|
||||
func RunServer(opts *server.Options) *server.Server {
|
||||
if opts == nil {
|
||||
opts = &defaultServerOptions
|
||||
opts = &DefaultTestOptions
|
||||
}
|
||||
s := server.New(opts)
|
||||
if s == nil {
|
||||
@@ -67,7 +64,6 @@ func runServer(opts *server.Options) *server.Server {
|
||||
return s
|
||||
}
|
||||
panic("Unable to start NATs Server in Go Routine")
|
||||
return nil
|
||||
}
|
||||
|
||||
func startServer(t tLogger, port int, other string) *natsServer {
|
||||
|
||||
Reference in New Issue
Block a user