123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- package goSam
- import "testing"
- func TestOptionAddrString(t *testing.T) {
- client, err := NewClientFromOptions(SetAddr("127.0.0.1:7656"), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionAddrStringLh(t *testing.T) {
- client, err := NewClientFromOptions(SetAddr("localhost:7656"), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionAddrSlice(t *testing.T) {
- client, err := NewClientFromOptions(SetAddr("127.0.0.1", "7656"), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionAddrMixedSlice(t *testing.T) {
- client, err := NewClientFromOptions(SetAddrMixed("127.0.0.1", 7656), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionHost(t *testing.T) {
- client, err := NewClientFromOptions(SetHost("127.0.0.1"), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionPort(t *testing.T) {
- client, err := NewClientFromOptions(SetPort("7656"), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionPortInt(t *testing.T) {
- client, err := NewClientFromOptions(SetPortInt(7656), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionDebug(t *testing.T) {
- client, err := NewClientFromOptions(SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionInLength(t *testing.T) {
- client, err := NewClientFromOptions(SetInLength(3), SetDebug(true))
- client.inlength()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionOutLength(t *testing.T) {
- client, err := NewClientFromOptions(SetInLength(3), SetDebug(true))
- client.outlength()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionInVariance(t *testing.T) {
- client, err := NewClientFromOptions(SetInVariance(1), SetDebug(true))
- client.invariance()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionOutVariance(t *testing.T) {
- client, err := NewClientFromOptions(SetOutVariance(1), SetDebug(true))
- client.outvariance()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionInQuantity(t *testing.T) {
- client, err := NewClientFromOptions(SetInQuantity(6), SetDebug(true))
- client.inquantity()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionOutQuantity(t *testing.T) {
- client, err := NewClientFromOptions(SetOutQuantity(6), SetDebug(true))
- client.outquantity()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionInBackups(t *testing.T) {
- client, err := NewClientFromOptions(SetInBackups(5), SetDebug(true))
- client.inbackups()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionOutBackups(t *testing.T) {
- client, err := NewClientFromOptions(SetOutBackups(5), SetDebug(true))
- client.outbackups()
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionEncryptLease(t *testing.T) {
- client, err := NewClientFromOptions(SetEncrypt(true), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionUnpublishedLease(t *testing.T) {
- client, err := NewClientFromOptions(SetUnpublished(true), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionReduceIdle(t *testing.T) {
- client, err := NewClientFromOptions(SetReduceIdle(true), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionReduceIdleTime(t *testing.T) {
- client, err := NewClientFromOptions(SetReduceIdleTime(300001), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionReduceIdleCount(t *testing.T) {
- client, err := NewClientFromOptions(SetReduceIdleQuantity(4), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionCloseIdle(t *testing.T) {
- client, err := NewClientFromOptions(SetCloseIdle(true), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
- func TestOptionCloseIdleTime(t *testing.T) {
- client, err := NewClientFromOptions(SetCloseIdleTime(300001), SetDebug(true))
- if err != nil {
- t.Fatalf("NewDefaultClient() Error: %q\n", err)
- }
- if err := client.Close(); err != nil {
- t.Fatalf("client.Close() Error: %q\n", err)
- }
- }
|