nNodes is now redundant
parent
de1122e133
commit
221954fbdc
|
@ -171,10 +171,10 @@ func createDatabase(t *testing.T, testName string, nodes cluster, database strin
|
||||||
}
|
}
|
||||||
|
|
||||||
// createRetentionPolicy creates a retetention policy and verifies that the creation was successful.
|
// createRetentionPolicy creates a retetention policy and verifies that the creation was successful.
|
||||||
func createRetentionPolicy(t *testing.T, testName string, nodes cluster, database, retention string, replicaN int) {
|
func createRetentionPolicy(t *testing.T, testName string, nodes cluster, database, retention string) {
|
||||||
t.Log("Creating retention policy")
|
t.Log("Creating retention policy")
|
||||||
serverURL := nodes[0].url
|
serverURL := nodes[0].url
|
||||||
replication := fmt.Sprintf("CREATE RETENTION POLICY bar ON foo DURATION 1h REPLICATION %d DEFAULT", replicaN)
|
replication := fmt.Sprintf("CREATE RETENTION POLICY bar ON foo DURATION 1h REPLICATION %d DEFAULT", len(nodes))
|
||||||
|
|
||||||
u := urlFor(serverURL, "query", url.Values{"q": []string{replication}})
|
u := urlFor(serverURL, "query", url.Values{"q": []string{replication}})
|
||||||
resp, err := http.Get(u.String())
|
resp, err := http.Get(u.String())
|
||||||
|
@ -204,7 +204,7 @@ func createRetentionPolicy(t *testing.T, testName string, nodes cluster, databas
|
||||||
|
|
||||||
// simpleWriteAndQuery creates a simple database, retention policy, and replicates
|
// simpleWriteAndQuery creates a simple database, retention policy, and replicates
|
||||||
// the data across all nodes. It then ensures a series of writes and queries are OK.
|
// the data across all nodes. It then ensures a series of writes and queries are OK.
|
||||||
func simpleWriteAndQuery(t *testing.T, testname string, nodes cluster, nNodes int) {
|
func simpleWriteAndQuery(t *testing.T, testname string, nodes cluster) {
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
serverURL := nodes[0].url
|
serverURL := nodes[0].url
|
||||||
var results client.Results
|
var results client.Results
|
||||||
|
@ -225,7 +225,7 @@ func simpleWriteAndQuery(t *testing.T, testname string, nodes cluster, nNodes in
|
||||||
|
|
||||||
// Need some time for server to get consensus and write data
|
// Need some time for server to get consensus and write data
|
||||||
// TODO corylanou query the status endpoint for the server and wait for the index to update to know the write was applied
|
// TODO corylanou query the status endpoint for the server and wait for the index to update to know the write was applied
|
||||||
time.Sleep(time.Duration(nNodes) * time.Second)
|
time.Sleep(time.Duration(len(nodes)) * time.Second)
|
||||||
|
|
||||||
// Query the data exists
|
// Query the data exists
|
||||||
t.Log("Query data")
|
t.Log("Query data")
|
||||||
|
@ -286,8 +286,8 @@ func Test_ServerSingleIntegration(t *testing.T) {
|
||||||
nodes := createCombinedNodeCluster(t, "single node", nNodes, basePort)
|
nodes := createCombinedNodeCluster(t, "single node", nNodes, basePort)
|
||||||
|
|
||||||
createDatabase(t, testName, nodes, "foo")
|
createDatabase(t, testName, nodes, "foo")
|
||||||
createRetentionPolicy(t, testName, nodes, "foo", "bar", nNodes)
|
createRetentionPolicy(t, testName, nodes, "foo", "bar")
|
||||||
simpleWriteAndQuery(t, testName, nodes, nNodes)
|
simpleWriteAndQuery(t, testName, nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_Server3NodeIntegration(t *testing.T) {
|
func Test_Server3NodeIntegration(t *testing.T) {
|
||||||
|
@ -300,8 +300,8 @@ func Test_Server3NodeIntegration(t *testing.T) {
|
||||||
nodes := createCombinedNodeCluster(t, testName, nNodes, basePort)
|
nodes := createCombinedNodeCluster(t, testName, nNodes, basePort)
|
||||||
|
|
||||||
createDatabase(t, testName, nodes, "foo")
|
createDatabase(t, testName, nodes, "foo")
|
||||||
createRetentionPolicy(t, testName, nodes, "foo", "bar", nNodes)
|
createRetentionPolicy(t, testName, nodes, "foo", "bar")
|
||||||
simpleWriteAndQuery(t, testName, nodes, nNodes)
|
simpleWriteAndQuery(t, testName, nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_Server5NodeIntegration(t *testing.T) {
|
func Test_Server5NodeIntegration(t *testing.T) {
|
||||||
|
@ -314,8 +314,8 @@ func Test_Server5NodeIntegration(t *testing.T) {
|
||||||
nodes := createCombinedNodeCluster(t, testName, nNodes, basePort)
|
nodes := createCombinedNodeCluster(t, testName, nNodes, basePort)
|
||||||
|
|
||||||
createDatabase(t, testName, nodes, "foo")
|
createDatabase(t, testName, nodes, "foo")
|
||||||
createRetentionPolicy(t, testName, nodes, "foo", "bar", nNodes)
|
createRetentionPolicy(t, testName, nodes, "foo", "bar")
|
||||||
simpleWriteAndQuery(t, testName, nodes, nNodes)
|
simpleWriteAndQuery(t, testName, nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func urlFor(u *url.URL, path string, params url.Values) *url.URL {
|
func urlFor(u *url.URL, path string, params url.Values) *url.URL {
|
||||||
|
|
Loading…
Reference in New Issue