-
Notifications
You must be signed in to change notification settings - Fork 16
/
get_topology_test.go
36 lines (29 loc) · 1002 Bytes
/
get_topology_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package tests
import (
"testing"
ravendb "github.com/ravendb/ravendb-go-client"
"github.com/stretchr/testify/assert"
)
func getTopologyTestCanGetTopology(t *testing.T, driver *RavenTestDriver) {
var err error
store := driver.getDocumentStoreMust(t)
defer store.Close()
command := ravendb.NewGetDatabaseTopologyCommand()
err = store.GetRequestExecutor("").ExecuteCommand(command, nil)
assert.NoError(t, err)
result := command.Result
assert.NotNil(t, result)
assert.NotEqual(t, result.Etag, "")
assert.Equal(t, len(result.Nodes), 1)
serverNode := result.Nodes[0]
assert.Equal(t, serverNode.URL, store.GetUrls()[0])
assert.Equal(t, serverNode.Database, store.GetDatabase())
assert.Equal(t, serverNode.ClusterTag, "A")
assert.Equal(t, serverNode.ServerRole, ravendb.ServerNodeRoleMember)
}
func TestGetTopology(t *testing.T) {
driver := createTestDriver(t)
destroy := func() { destroyDriver(t, driver) }
defer recoverTest(t, destroy)
getTopologyTestCanGetTopology(t, driver)
}