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


Golang StoreAdapter.Disconnect方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry/storeadapter.StoreAdapter.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:Golang StoreAdapter.Disconnect方法的具体用法?Golang StoreAdapter.Disconnect怎么用?Golang StoreAdapter.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry/storeadapter.StoreAdapter的用法示例。


在下文中一共展示了StoreAdapter.Disconnect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

		var err error
		conf, err = config.DefaultConfig()
		Ω(err).ShouldNot(HaveOccurred())
		storeAdapter = etcdstoreadapter.NewETCDStoreAdapter(etcdRunner.NodeURLS(), workerpool.NewWorkerPool(conf.StoreMaxConcurrentRequests))
		err = storeAdapter.Connect()
		Ω(err).ShouldNot(HaveOccurred())

		message1 = models.NewPendingStopMessage(time.Unix(100, 0), 10, 4, "ABC", "123", "XYZ", models.PendingStopMessageReasonInvalid)
		message2 = models.NewPendingStopMessage(time.Unix(100, 0), 10, 4, "DEF", "456", "ALPHA", models.PendingStopMessageReasonInvalid)
		message3 = models.NewPendingStopMessage(time.Unix(100, 0), 10, 4, "GHI", "789", "BETA", models.PendingStopMessageReasonInvalid)

		store = NewStore(conf, storeAdapter, fakelogger.NewFakeLogger())
	})

	AfterEach(func() {
		storeAdapter.Disconnect()
	})

	Describe("Saving stop messages", func() {
		BeforeEach(func() {
			err := store.SavePendingStopMessages(
				message1,
				message2,
			)
			Ω(err).ShouldNot(HaveOccurred())
		})

		It("stores the passed in stop messages", func() {
			node, err := storeAdapter.ListRecursively("/hm/v1/stop")
			Ω(err).ShouldNot(HaveOccurred())
			Ω(node.ChildNodes).Should(HaveLen(2))
开发者ID:karlpilkington,项目名称:golang-devops-stuff,代码行数:31,代码来源:pending_stop_messages_test.go

示例2: startComponent

func startComponent(path string, shortName string, colorCode uint64, arg ...string) *gexec.Session {
	var session *gexec.Session
	var err error
	startCommand := exec.Command(path, arg...)
	session, err = gexec.Start(
		startCommand,
		gexec.NewPrefixedWriter(fmt.Sprintf("\x1b[32m[o]\x1b[%dm[%s]\x1b[0m ", colorCode, shortName), GinkgoWriter),
		gexec.NewPrefixedWriter(fmt.Sprintf("\x1b[91m[e]\x1b[%dm[%s]\x1b[0m ", colorCode, shortName), GinkgoWriter))
	Expect(err).ShouldNot(HaveOccurred())
	return session
}

func waitOnURL(url string) {
	Eventually(func() error {
		_, err := http.Get(url)
		return err
	}, 3).ShouldNot(HaveOccurred())
}

var _ = AfterEach(func() {
	metronSession.Kill().Wait()
	dopplerSession.Kill().Wait()
	tcSession.Kill().Wait()
})

var _ = AfterSuite(func() {
	etcdAdapter.Disconnect()
	etcdRunner.Stop()
	gexec.CleanupBuildArtifacts()
})
开发者ID:Jonty,项目名称:loggregator,代码行数:30,代码来源:integration_test_suite_test.go

示例3: TestDB

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestDB(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "DB Suite")
}

var etcdClient storeadapter.StoreAdapter
var etcdPort int
var etcdUrl string
var etcdRunner *etcdstorerunner.ETCDClusterRunner
var routingAPIBinPath string

var _ = BeforeEach(func() {
	etcdPort = 4001 + GinkgoParallelNode()
	etcdUrl = fmt.Sprintf("http://127.0.0.1:%d", etcdPort)
	etcdRunner = etcdstorerunner.NewETCDClusterRunner(etcdPort, 1)
	etcdRunner.Start()

	etcdClient = etcdRunner.Adapter()
})

var _ = AfterEach(func() {
	etcdClient.Disconnect()
	etcdRunner.Stop()
})
开发者ID:simonjohansson,项目名称:gorouter,代码行数:30,代码来源:db_suite_test.go

示例4:

		}
		return appServices
	}

	BeforeEach(func() {
		adapter = etcdRunner.Adapter()

		listener, outAddChan, outRemoveChan = NewAppServiceStoreWatcher(adapter)

		app1Service1 = domain.AppService{AppId: "app-1", Url: "syslog://example.com:12345"}
		app1Service2 = domain.AppService{AppId: "app-1", Url: "syslog://example.com:12346"}
		app2Service1 = domain.AppService{AppId: "app-2", Url: "syslog://example.com:12345"}
	})

	AfterEach(func() {
		err := adapter.Disconnect()
		Expect(err).NotTo(HaveOccurred())
	})

	Describe("Shutdown", func() {
		BeforeEach(func() {
			go listener.Run()

			adapter.Disconnect()
		})

		PIt("should close the outgoing channels", func() {
			Expect(outAddChan).To(BeClosed())
			Expect(outRemoveChan).To(BeClosed())
		})
	})
开发者ID:james-masson,项目名称:loggregator,代码行数:31,代码来源:app_service_store_watcher_test.go

示例5:

		Expect(err).NotTo(HaveOccurred())

		c := cache.NewAppServiceCache()
		watcher, outAddChan, outRemoveChan = NewAppServiceStoreWatcher(adapter, c, loggertesthelper.Logger())

		runWatcher = func() {
			watcherRunComplete.Add(1)
			go func() {
				watcher.Run()
				watcherRunComplete.Done()
			}()
		}
	})

	AfterEach(func() {
		Expect(adapter.Disconnect()).To(Succeed())
		watcherRunComplete.Wait()
	})

	Describe("Shutdown", func() {
		It("should close the outgoing channels", func() {
			runWatcher()

			time.Sleep(500 * time.Millisecond)
			adapter.Disconnect()

			Eventually(outRemoveChan).Should(BeClosed())
			Eventually(outAddChan).Should(BeClosed())
		})
	})
开发者ID:pkdevbox,项目名称:loggregatorlib,代码行数:30,代码来源:app_service_store_watcher_test.go


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