cluster retention auto create test

pull/4848/head
Cory LaNou 2015-12-01 15:16:05 -06:00
parent 52da1c76d6
commit 0c2588ed43
3 changed files with 48 additions and 14 deletions

View File

@ -322,3 +322,34 @@ func TestCluster_RetentionPolicyCommands(t *testing.T) {
}
}
}
func TestCluster_DatabaseRetentionPolicyAutoCreate(t *testing.T) {
t.Parallel()
t.Skip()
c, err := NewCluster(5)
if err != nil {
t.Fatalf("error creating cluster: %s", err)
}
defer c.Close()
test := tests.load(t, "retention_policy_auto_create")
for _, query := range test.queries {
if query.skip {
t.Logf("SKIP:: %s", query.name)
continue
}
t.Logf("Running %s", query.name)
if query.once {
if _, err := c.Query(query); err != nil {
t.Error(query.Error(err))
} else if !query.success() {
t.Error(query.failureMessage())
}
continue
}
if err := c.QueryAll(query); err != nil {
t.Error(query.Error(err))
}
}
}

View File

@ -384,6 +384,22 @@ func init() {
},
}
tests["retention_policy_auto_create"] = Test{
queries: []*Query{
&Query{
name: "create database should succeed",
command: `CREATE DATABASE db0`,
exp: `{"results":[{}]}`,
once: true,
},
&Query{
name: "show retention policies should return auto-created policy",
command: `SHOW RETENTION POLICIES ON db0`,
exp: `{"results":[{"series":[{"columns":["name","duration","replicaN","default"],"values":[["default","0",1,true]]}]}]}`,
},
},
}
}
func (tests Tests) load(t *testing.T, key string) Test {

View File

@ -231,20 +231,7 @@ func TestServer_DatabaseRetentionPolicyAutoCreate(t *testing.T) {
s := OpenServer(NewConfig(), "")
defer s.Close()
test := Test{
queries: []*Query{
&Query{
name: "create database should succeed",
command: `CREATE DATABASE db0`,
exp: `{"results":[{}]}`,
},
&Query{
name: "show retention policies should return auto-created policy",
command: `SHOW RETENTION POLICIES ON db0`,
exp: `{"results":[{"series":[{"columns":["name","duration","replicaN","default"],"values":[["default","0",1,true]]}]}]}`,
},
},
}
test := tests.load(t, "retention_policy_auto_create")
for _, query := range test.queries {
if query.skip {