当前位置: 首页>>代码示例>>Golang>>正文


Golang FakeStoreAdapter.OnReleaseNodeChannel方法代码示例

本文整理汇总了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)
开发者ID:nagyistge,项目名称:hm9000,代码行数:32,代码来源:daemon_test.go


注:本文中的github.com/cloudfoundry/storeadapter/fakestoreadapter.FakeStoreAdapter.OnReleaseNodeChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。