gorqlite/cluster_test.go

39 lines
489 B
Go
Raw Permalink Normal View History

2016-09-01 16:47:49 +00:00
package gorqlite
import "testing"
import "os"
func TestInitCluster(t *testing.T) {
2017-07-15 20:50:10 +00:00
TraceOn(os.Stderr)
2016-09-01 16:47:49 +00:00
t.Logf("trying Open")
conn, err := Open(testUrl())
2017-07-15 20:50:10 +00:00
if err != nil {
2016-09-01 16:47:49 +00:00
t.Logf("--> FAILED")
2017-07-15 20:50:10 +00:00
t.Fatal(err)
2016-09-01 16:47:49 +00:00
}
l, err := conn.Leader()
2017-07-15 20:50:10 +00:00
if err != nil {
2016-09-01 16:47:49 +00:00
t.Logf("--> FAILED")
t.Fail()
}
2017-07-15 20:50:10 +00:00
if len(l) < 1 {
2016-09-01 16:47:49 +00:00
t.Logf("--> FAILED")
t.Fail()
}
p, err := conn.Peers()
2017-07-15 20:50:10 +00:00
if err != nil {
2016-09-01 16:47:49 +00:00
t.Logf("--> FAILED")
t.Fail()
}
2017-07-15 20:50:10 +00:00
if len(p) < 1 {
2016-09-01 16:47:49 +00:00
t.Logf("--> FAILED")
t.Fail()
}
}