Пример #1
0
func (s *DatamodelSuite) TestDNSModel(c *C) {
	Zk.RecursiveDelete(helper.GetBaseDNSPath())
	zkDNS := DNS(app, env)
	err := zkDNS.Save()
	c.Assert(err, IsNil)
	fetchedDNS, err := GetDNS(app, env)
	c.Assert(err, IsNil)
	c.Assert(zkDNS, DeepEquals, fetchedDNS)
	zkDNS.Shas = map[string]bool{"sha1": true, "sha2": true}
	zkDNS.RecordIDs = []string{"rid1", "rid2"}
	zkDNS.Save()
	fetchedDNS, err = GetDNS(app, env)
	c.Assert(err, IsNil)
	c.Assert(zkDNS, DeepEquals, fetchedDNS)
	err = zkDNS.Delete()
	c.Assert(err, IsNil)
	_, err = GetDNS(app, env)
	c.Assert(err, Not(IsNil))
}
Пример #2
0
func (r *ZkDNS) path() string {
	return helper.GetBaseDNSPath(r.App, r.Env)
}
Пример #3
0
func GetDNS(app, env string) (zd *ZkDNS, err error) {
	zd = &ZkDNS{}
	err = getJson(helper.GetBaseDNSPath(app, env), zd)
	return
}