本文整理匯總了Golang中github.com/pgpst/pgpst/internal/gopkg/in/check/v1.C.Logf方法的典型用法代碼示例。如果您正苦於以下問題:Golang C.Logf方法的具體用法?Golang C.Logf怎麽用?Golang C.Logf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pgpst/pgpst/internal/gopkg/in/check/v1.C
的用法示例。
在下文中一共展示了C.Logf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestClusterNodeHealth
func (s *RethinkSuite) TestClusterNodeHealth(c *test.C) {
session, err := Connect(ConnectOpts{
Addresses: []string{url, url2, url3},
DiscoverHosts: true,
NodeRefreshInterval: time.Second,
MaxIdle: 50,
MaxOpen: 200,
})
c.Assert(err, test.IsNil)
attempts := 0
failed := 0
seconds := 0
t := time.NewTimer(time.Second * 10)
tick := time.NewTicker(time.Second)
for {
select {
// Fail if deadline has passed
case <-tick.C:
seconds++
c.Logf("%ds elapsed", seconds)
case <-t.C:
// Execute queries for 10s and check that at most 5% of the queries fail
c.Logf("%d of the %d(%d%%) queries failed", failed, attempts, (failed / attempts))
c.Assert(failed <= 100, test.Equals, true)
return
default:
attempts++
if err := Expr(1).Exec(session); err != nil {
c.Logf("Query failed, %s", err)
failed++
}
}
}
}