tests should run in debug mode. Don't attempt to hot-restore SAM sessions by replacing the net.Conn parts inside if they go down, just let it die and tell the user to restart.
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
//go:build nettest
|
||||
// +build nettest
|
||||
|
||||
package goSam
|
||||
@ -45,7 +46,7 @@ func TestCompositeClient(t *testing.T) {
|
||||
// http.HandleFunc("/", HelloServer)
|
||||
go http.Serve(listener3, nil)
|
||||
|
||||
sam, err := NewClientFromOptions(SetDebug(false))
|
||||
sam, err := NewClientFromOptions(SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewDefaultClient() Error: %q\n", err)
|
||||
}
|
||||
@ -83,7 +84,7 @@ func TestCompositeClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClientHello(t *testing.T) {
|
||||
client, err := NewClientFromOptions(SetDebug(false))
|
||||
client, err := NewClientFromOptions(SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewDefaultClient() Error: %q\n", err)
|
||||
}
|
||||
@ -94,7 +95,7 @@ func TestClientHello(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewDestination(t *testing.T) {
|
||||
client, err := NewClientFromOptions(SetDebug(false))
|
||||
client, err := NewClientFromOptions(SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewDefaultClient() Error: %q\n", err)
|
||||
}
|
||||
|
8
dial.go
8
dial.go
@ -74,13 +74,9 @@ func (c *Client) DialStreamingContextFree(addr string) (net.Conn, error) {
|
||||
}
|
||||
}
|
||||
|
||||
d, err := c.NewClient(c.NewID())
|
||||
err = c.StreamConnect(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = d.StreamConnect(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return d.SamConn, nil
|
||||
return c.SamConn, nil
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build nettest
|
||||
// +build nettest
|
||||
|
||||
package goSam
|
||||
@ -10,7 +11,7 @@ import (
|
||||
func TestClientLookupInvalid(t *testing.T) {
|
||||
var err error
|
||||
|
||||
client, err := NewClientFromOptions(SetDebug(false))
|
||||
client, err := NewClientFromOptions(SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewDefaultClient() Error: %q\n", err)
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
//go:build nettest
|
||||
// +build nettest
|
||||
|
||||
package goSam
|
||||
@ -36,7 +37,7 @@ func (c *Client) validCreate() (string, error) {
|
||||
}
|
||||
|
||||
func TestOptionAddrString(t *testing.T) {
|
||||
client, err := NewClientFromOptions(SetAddr("127.0.0.1:7656"), SetDebug(false))
|
||||
client, err := NewClientFromOptions(SetAddr("127.0.0.1:7656"), SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewClientFromOptions() Error: %q\n", err)
|
||||
}
|
||||
@ -55,7 +56,7 @@ func TestOptionAddrString(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOptionAddrStringLh(t *testing.T) {
|
||||
client, err := NewClientFromOptions(SetAddr("localhost:7656"), SetDebug(false))
|
||||
client, err := NewClientFromOptions(SetAddr("localhost:7656"), SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewClientFromOptions() Error: %q\n", err)
|
||||
}
|
||||
@ -74,7 +75,7 @@ func TestOptionAddrStringLh(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOptionAddrSlice(t *testing.T) {
|
||||
client, err := NewClientFromOptions(SetAddr("127.0.0.1", "7656"), SetDebug(false))
|
||||
client, err := NewClientFromOptions(SetAddr("127.0.0.1", "7656"), SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewClientFromOptions() Error: %q\n", err)
|
||||
}
|
||||
@ -93,7 +94,7 @@ func TestOptionAddrSlice(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOptionAddrMixedSlice(t *testing.T) {
|
||||
client, err := NewClientFromOptions(SetAddrMixed("127.0.0.1", 7656), SetDebug(false))
|
||||
client, err := NewClientFromOptions(SetAddrMixed("127.0.0.1", 7656), SetDebug(true))
|
||||
if err != nil {
|
||||
t.Fatalf("NewClientFromOptions() Error: %q\n", err)
|
||||
}
|
||||
@ -124,7 +125,7 @@ func TestOptionHost(t *testing.T) {
|
||||
SetInBackups(2),
|
||||
SetOutBackups(2),
|
||||
SetEncrypt(true),
|
||||
SetDebug(false),
|
||||
SetDebug(true),
|
||||
SetUnpublished(true),
|
||||
SetReduceIdle(true),
|
||||
SetReduceIdleTime(300001),
|
||||
@ -162,7 +163,7 @@ func TestOptionPortInt(t *testing.T) {
|
||||
SetInBackups(2),
|
||||
SetOutBackups(2),
|
||||
SetEncrypt(true),
|
||||
SetDebug(false),
|
||||
SetDebug(true),
|
||||
SetUnpublished(true),
|
||||
SetReduceIdle(true),
|
||||
SetReduceIdleTime(300001),
|
||||
|
@ -11,8 +11,9 @@ func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// CreateSession creates a new STREAM Session.
|
||||
// Returns the Id for the new Client.
|
||||
// CreateSession creates a new Session of type style, with an optional destination.
|
||||
// an empty destination is interpreted as "TRANSIENT"
|
||||
// Returns the destination for the new Client or an error.
|
||||
func (c *Client) CreateSession(style, dest string) (string, error) {
|
||||
if dest == "" {
|
||||
dest = "TRANSIENT"
|
||||
|
Reference in New Issue
Block a user