func TestReceiveDelete(t *testing.T) { if err := etcdtest.ResetData(); err != nil { t.Error(err) return } c, err := New(Options{etcdtest.Urls, "/skippertest", 0, false}) if err != nil { t.Error(err) return } c.LoadAll() etcdtest.DeleteData("pdp") rs, ds, err := c.LoadUpdate() if err != nil { t.Error(err) } if !checkDeleted(ds, "pdp") { t.Error("failed to receive the right deleted id") } if len(rs) != 0 { t.Error("unexpected upsert") } }
func TestReceiveInsert(t *testing.T) { if err := etcdtest.ResetData(); err != nil { t.Error(err) return } c, err := New(Options{etcdtest.Urls, "/skippertest", 0, false}) if err != nil { t.Error(err) return } _, err = c.LoadAll() if err != nil { t.Error(err) } etcdtest.PutData("catalog", `Path("/pdp") -> "https://catalog.example.org"`) rs, ds, err := c.LoadUpdate() if err != nil { t.Error(err) } if !checkBackend(rs, "catalog", "https://catalog.example.org") { t.Error("failed to receive the right backend") } if len(ds) != 0 { t.Error("unexpected delete") } }
func TestReceivesInitial(t *testing.T) { if err := etcdtest.ResetData(); err != nil { t.Error(t) return } expectedEndpoints := strings.Join(etcdtest.Urls, ";") c, err := New(Options{etcdtest.Urls, "/skippertest", 0, false}) if err != nil { t.Error(err) return } rs, err := c.LoadAll() if err != nil { t.Error(err) } if !checkInitial(rs) { t.Error("failed to receive the right docs") } if strings.Join(c.endpoints, ";") != expectedEndpoints { t.Error("wrong endpoints rotation") } }
func TestReceivesInitial(t *testing.T) { if err := etcdtest.ResetData(); err != nil { t.Error(t) return } c, err := New(Options{etcdtest.Urls, "/skippertest", 0, false}) if err != nil { t.Error(err) return } rs, err := c.LoadAll() if err != nil { t.Error(err) } if !checkInitial(rs) { t.Error("failed to receive the right docs") } }