Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce retention policies #1562

Merged
merged 13 commits into from
Feb 11, 2015
Prev Previous commit
Next Next commit
Unit-test deletion of shard groups
otoolep committed Feb 11, 2015
commit 8dae2c226892c7ffadebe5494480fc2c6fed5a7a
35 changes: 35 additions & 0 deletions server_test.go
Original file line number Diff line number Diff line change
@@ -892,6 +892,41 @@ func TestServer_CreateShardGroupIfNotExist(t *testing.T) {
}
}

func TestServer_DeleteShardGroup(t *testing.T) {
s := OpenServer(NewMessagingClient())
defer s.Close()
s.CreateDatabase("foo")

if err := s.CreateRetentionPolicy("foo", &influxdb.RetentionPolicy{Name: "bar"}); err != nil {
t.Fatal(err)
}

if err := s.CreateShardGroupIfNotExists("foo", "bar", time.Time{}); err != nil {
t.Fatal(err)
}

// Get the new shard's ID.
var g []*influxdb.ShardGroup
g, err := s.ShardGroups("foo")
if err != nil {
t.Fatal(err)
} else if len(g) != 1 {
t.Fatalf("expected 1 shard group but found %d", len(g))
}
id := g[0].ID

// Delete the shard group and verify it's gone.
if err := s.DeleteShardGroup("foo", "bar", id); err != nil {
t.Fatal(err)
}
g, err = s.ShardGroups("foo")
if err != nil {
t.Fatal(err)
} else if len(g) != 0 {
t.Fatalf("expected 0 shard group but found %d", len(g))
}
}

/* TODO(benbjohnson): Change test to not expose underlying series ids directly.
func TestServer_Measurements(t *testing.T) {
s := OpenServer(NewMessagingClient())