本文整理汇总了Golang中github.com/cloudfoundry/storeadapter/fakestoreadapter.FakeStoreAdapter.OnReleaseNodeChannel方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeStoreAdapter.OnReleaseNodeChannel方法的具体用法?Golang FakeStoreAdapter.OnReleaseNodeChannel怎么用?Golang FakeStoreAdapter.OnReleaseNodeChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/storeadapter/fakestoreadapter.FakeStoreAdapter
的用法示例。
在下文中一共展示了FakeStoreAdapter.OnReleaseNodeChannel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
"github.com/cloudfoundry/hm9000/testhelpers/fakelogger"
"github.com/cloudfoundry/storeadapter/fakestoreadapter"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Daemon", func() {
var adapter *fakestoreadapter.FakeStoreAdapter
BeforeEach(func() {
adapter = fakestoreadapter.New()
})
It("should call the function every PERIOD seconds, unless the function takes *longer* than PERIOD, and it should timeout when the function takes *too* long", func() {
adapter.OnReleaseNodeChannel = func(releaseNodeChannel chan chan bool) {
released := <-releaseNodeChannel
released <- true
}
adapter.MaintainNodeStatus <- true
callTimes := make(chan float64, 4)
i := 0
var startTime time.Time
err := Daemonize("Daemon Test", func() error {
if i == 0 {
startTime = time.Now()
}
callTimes <- time.Since(startTime).Seconds()
i += 1
time.Sleep(time.Duration(i*10) * time.Millisecond)