本文整理匯總了Golang中github.com/zenoss/serviced/dao.Host.CreatedAt方法的典型用法代碼示例。如果您正苦於以下問題:Golang Host.CreatedAt方法的具體用法?Golang Host.CreatedAt怎麽用?Golang Host.CreatedAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/zenoss/serviced/dao.Host
的用法示例。
在下文中一共展示了Host.CreatedAt方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestDao_GetHost
func TestDao_GetHost(t *testing.T) {
controlPlaneDao.RemoveHost("default", &unused)
host := dao.NewHost()
host.Id = "default"
controlPlaneDao.AddHost(*host, &id)
var result = dao.Host{}
err := controlPlaneDao.GetHost("default", &result)
result.CreatedAt = host.CreatedAt
result.UpdatedAt = host.UpdatedAt
if err == nil {
if *host != result {
t.Errorf("Unexpected Host: expected=%+v, actual=%+v", host, result)
}
} else {
t.Errorf("Unexpected Error Retrieving Host: err=%s", err)
}
}
示例2: TestDao_UpdateHost
func TestDao_UpdateHost(t *testing.T) {
controlPlaneDao.RemoveHost("default", &unused)
host := dao.NewHost()
host.Id = "default"
controlPlaneDao.AddHost(*host, &id)
host.Name = "hostname"
host.IpAddr = "127.0.0.1"
err := controlPlaneDao.UpdateHost(*host, &unused)
if err != nil {
t.Errorf("Failure updating host %-v with error: %s", host, err)
t.Fail()
}
var result = dao.Host{}
controlPlaneDao.GetHost("default", &result)
result.CreatedAt = host.CreatedAt
result.UpdatedAt = host.UpdatedAt
if *host != result {
t.Errorf("%+v != %+v", result, host)
t.Fail()
}
}