示例#1
0
// Ensure an error is returned when deleting a non-existent policy.
func TestData_DropRetentionPolicy_ErrRetentionPolicyNotFound(t *testing.T) {
	var data meta.Data
	if err := data.CreateDatabase("db0"); err != nil {
		t.Fatal(err)
	}
	if err := data.DropRetentionPolicy("db0", "rp0"); err != meta.ErrRetentionPolicyNotFound {
		t.Fatal(err)
	}
}
示例#2
0
// Ensure a retention policy can be removed.
func TestData_DropRetentionPolicy(t *testing.T) {
	var data meta.Data
	if err := data.CreateDatabase("db0"); err != nil {
		t.Fatal(err)
	} else if err = data.CreateRetentionPolicy("db0", &meta.RetentionPolicyInfo{Name: "rp0"}); err != nil {
		t.Fatal(err)
	}

	if err := data.DropRetentionPolicy("db0", "rp0"); err != nil {
		t.Fatal(err)
	} else if len(data.Databases[0].RetentionPolicies) != 0 {
		t.Fatalf("unexpected policies: %#v", data.Databases[0].RetentionPolicies)
	}
}