fix unit tests after backing out proto change
parent
f91fd0b8ae
commit
c84e9b38d0
|
@ -139,14 +139,14 @@ func TestMetaService_Databases(t *testing.T) {
|
|||
defer c.Close()
|
||||
|
||||
// Create two databases.
|
||||
db, err := c.CreateDatabase("db0", false)
|
||||
db, err := c.CreateDatabase("db0")
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
} else if db.Name != "db0" {
|
||||
t.Fatalf("db name wrong: %s", db.Name)
|
||||
}
|
||||
|
||||
db, err = c.CreateDatabase("db1", false)
|
||||
db, err = c.CreateDatabase("db1")
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
} else if db.Name != "db1" {
|
||||
|
@ -230,49 +230,13 @@ func TestMetaService_CreateRetentionPolicy(t *testing.T) {
|
|||
} else if rp.ReplicaN != 1 {
|
||||
t.Fatalf("rp replication wrong: %d", rp.ReplicaN)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMetaService_CreateRetentionPolicyIfNotExists(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d, s, c := newServiceAndClient()
|
||||
defer os.RemoveAll(d)
|
||||
defer s.Close()
|
||||
defer c.Close()
|
||||
|
||||
if res := c.ExecuteStatement(mustParseStatement("CREATE DATABASE db0")); res.Err != nil {
|
||||
// Create the same policy. Should not error.
|
||||
if res := c.ExecuteStatement(mustParseStatement(qry)); res.Err != nil {
|
||||
t.Fatal(res.Err)
|
||||
}
|
||||
|
||||
db, err := c.Database("db0")
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
} else if db.Name != "db0" {
|
||||
t.Fatalf("db name wrong: %s", db.Name)
|
||||
}
|
||||
|
||||
rpi := &meta.RetentionPolicyInfo{
|
||||
Name: "rp0",
|
||||
ReplicaN: 1,
|
||||
Duration: time.Hour,
|
||||
}
|
||||
|
||||
// InfluxQL doesn't support IF NOT EXISTS yet so use the API.
|
||||
rp, err := c.CreateRetentionPolicy("db0", rpi, true)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else if rp.Name != "rp0" {
|
||||
t.Fatalf("rp name wrong: %s", rp.Name)
|
||||
} else if rp.Duration != time.Hour {
|
||||
t.Fatalf("rp duration wrong: %s", rp.Duration.String())
|
||||
} else if rp.ReplicaN != 1 {
|
||||
t.Fatalf("rp replication wrong: %d", rp.ReplicaN)
|
||||
}
|
||||
|
||||
// Create the same policy with ifNotExists = true. Shouldn't error.
|
||||
rp, err = c.CreateRetentionPolicy("db0", rpi, true)
|
||||
|
||||
rp, err = c.RetentionPolicy("db0", "rp0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else if rp.Name != "rp0" {
|
||||
|
@ -456,7 +420,7 @@ func TestMetaService_CommandAgainstNonLeader(t *testing.T) {
|
|||
t.Fatalf("meta nodes wrong: %v", metaNodes)
|
||||
}
|
||||
|
||||
if _, err := c.CreateDatabase("foo", true); err != nil {
|
||||
if _, err := c.CreateDatabase("foo"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue