// Ensure that a default retention policy can be set. func TestData_SetDefaultRetentionPolicy(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", ReplicaN: 1}); err != nil { t.Fatal(err) } // Verify there is no default policy on the database initially. if name := data.Database("db0").DefaultRetentionPolicy; name != "" { t.Fatalf("unexpected initial default retention policy: %s", name) } // Set the default policy. if err := data.SetDefaultRetentionPolicy("db0", "rp0"); err != nil { t.Fatal(err) } // Verify the default policy is now set. if name := data.Database("db0").DefaultRetentionPolicy; name != "rp0" { t.Fatalf("unexpected default retention policy: %s", name) } }