• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang arvadostest.StartKeep函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中git/curoverse/com/arvados/git/sdk/go/arvadostest.StartKeep函数的典型用法代码示例。如果您正苦于以下问题:Golang StartKeep函数的具体用法?Golang StartKeep怎么用?Golang StartKeep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: SetupDataManagerTest

func SetupDataManagerTest(t *testing.T) {
	os.Setenv("ARVADOS_API_HOST_INSECURE", "true")

	// start api and keep servers
	arvadostest.ResetEnv()
	arvadostest.StartAPI()
	arvadostest.StartKeep(2, false)

	var err error
	arv, err = arvadosclient.MakeArvadosClient()
	if err != nil {
		t.Fatalf("Error making arvados client: %s", err)
	}
	arv.ApiToken = arvadostest.DataManagerToken

	// keep client
	keepClient = &keepclient.KeepClient{
		Arvados:       &arv,
		Want_replicas: 2,
		Client:        &http.Client{},
	}

	// discover keep services
	if err = keepClient.DiscoverKeepServers(); err != nil {
		t.Fatalf("Error discovering keep services: %s", err)
	}
	keepServers = []string{}
	for _, host := range keepClient.LocalRoots() {
		keepServers = append(keepServers, host)
	}
}
开发者ID:aflyhorse,项目名称:arvados,代码行数:31,代码来源:datamanager_test.go


示例2: SetUpSuite

func (s *NoKeepServerSuite) SetUpSuite(c *C) {
	arvadostest.StartAPI()
	// We need API to have some keep services listed, but the
	// services themselves should be unresponsive.
	arvadostest.StartKeep(2, false)
	arvadostest.StopKeep(2)
}
开发者ID:Kunde21,项目名称:arvados,代码行数:7,代码来源:keepproxy_test.go


示例3: SetUpSuite

func (s *ServerRequiredSuite) SetUpSuite(c *C) {
	if *no_server {
		c.Skip("Skipping tests that require server")
		return
	}
	arvadostest.StartAPI()
	arvadostest.StartKeep()
}
开发者ID:WangZhenfei,项目名称:arvados,代码行数:8,代码来源:keepclient_test.go


示例4: TestSetupKeepClient_NoBlobSignatureTTL

func (s *ServerNotRequiredSuite) TestSetupKeepClient_NoBlobSignatureTTL(c *C) {
	var srcConfig apiConfig
	srcConfig.APIHost = os.Getenv("ARVADOS_API_HOST")
	srcConfig.APIToken = arvadostest.DataManagerToken
	srcConfig.APIHostInsecure = matchTrue.MatchString(os.Getenv("ARVADOS_API_HOST_INSECURE"))
	arvadostest.StartKeep(2, false)

	_, ttl, err := setupKeepClient(srcConfig, srcKeepServicesJSON, false, 0, 0)
	c.Check(err, IsNil)
	c.Assert(ttl, Equals, blobSignatureTTL)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:11,代码来源:keep-rsync_test.go


示例5: Test_doMain_WithNoSuchBlockHashFile

func (s *DoMainTestSuite) Test_doMain_WithNoSuchBlockHashFile(c *C) {
	config := setupConfigFile(c, "config")
	defer os.Remove(config)

	arvadostest.StartKeep(2, false)
	defer arvadostest.StopKeep(2)

	args := []string{"-config", config, "-block-hash-file", "no-such-file"}
	err := doMain(args)
	c.Assert(strings.Contains(err.Error(), "no such file or directory"), Equals, true)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:11,代码来源:keep-block-check_test.go


示例6: Test_doMain_WithNoBlockHashFile

func (s *DoMainTestSuite) Test_doMain_WithNoBlockHashFile(c *C) {
	config := setupConfigFile(c, "config")
	defer os.Remove(config)

	// Start keepservers.
	arvadostest.StartKeep(2, false)
	defer arvadostest.StopKeep(2)

	args := []string{"-config", config}
	err := doMain(args)
	c.Assert(strings.Contains(err.Error(), "block-hash-file not specified"), Equals, true)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:12,代码来源:keep-block-check_test.go


示例7: SetUpSuite

func (s *IntegrationSuite) SetUpSuite(c *check.C) {
	arvadostest.StartAPI()
	arvadostest.StartKeep(2, true)

	arv, err := arvadosclient.MakeArvadosClient()
	c.Assert(err, check.Equals, nil)
	arv.ApiToken = arvadostest.ActiveToken
	kc, err := keepclient.MakeKeepClient(&arv)
	c.Assert(err, check.Equals, nil)
	kc.PutB([]byte("Hello world\n"))
	kc.PutB([]byte("foo"))
	kc.PutB([]byte("foobar"))
}
开发者ID:pombredanne,项目名称:arvados,代码行数:13,代码来源:server_test.go


示例8: Test_doMainWithSrcAndDstConfig

func (s *DoMainTestSuite) Test_doMainWithSrcAndDstConfig(c *C) {
	srcConfig := setupConfigFile(c, "src")
	dstConfig := setupConfigFile(c, "dst")
	args := []string{"-src", srcConfig.Name(), "-dst", dstConfig.Name()}
	os.Args = append(os.Args, args...)

	// Start keepservers. Since we are not doing any tweaking as
	// in setupRsync func, kcSrc and kcDst will be the same and no
	// actual copying to dst will happen, but that's ok.
	arvadostest.StartKeep(2, false)
	defer arvadostest.StopKeep(2)

	err := doMain()
	c.Check(err, IsNil)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:15,代码来源:keep-rsync_test.go


示例9: setupKeepBlockCheckWithTTL

func setupKeepBlockCheckWithTTL(c *C, enforcePermissions bool, keepServicesJSON string, ttl time.Duration) {
	var config apiConfig
	config.APIHost = os.Getenv("ARVADOS_API_HOST")
	config.APIToken = arvadostest.DataManagerToken
	config.APIHostInsecure = matchTrue.MatchString(os.Getenv("ARVADOS_API_HOST_INSECURE"))

	// Start Keep servers
	arvadostest.StartKeep(2, enforcePermissions)

	// setup keepclients
	var err error
	kc, ttl, err = setupKeepClient(config, keepServicesJSON, ttl)
	c.Assert(ttl, Equals, blobSignatureTTL)
	c.Check(err, IsNil)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:15,代码来源:keep-block-check_test.go


示例10: SetupPullWorkerIntegrationTest

func SetupPullWorkerIntegrationTest(t *testing.T, testData PullWorkIntegrationTestData, wantData bool) PullRequest {
	os.Setenv("ARVADOS_API_HOST_INSECURE", "true")

	// start api and keep servers
	arvadostest.StartAPI()
	arvadostest.StartKeep()

	// make arvadosclient
	arv, err := arvadosclient.MakeArvadosClient()
	if err != nil {
		t.Error("Error creating arv")
	}

	// keep client
	keepClient = &keepclient.KeepClient{
		Arvados:       &arv,
		Want_replicas: 1,
		Using_proxy:   true,
		Client:        &http.Client{},
	}

	// discover keep services
	var servers []string
	if err := keepClient.DiscoverKeepServers(); err != nil {
		t.Error("Error discovering keep services")
	}
	for _, host := range keepClient.LocalRoots() {
		servers = append(servers, host)
	}

	// Put content if the test needs it
	if wantData {
		locator, _, err := keepClient.PutB([]byte(testData.Content))
		if err != nil {
			t.Errorf("Error putting test data in setup for %s %s %v", testData.Content, locator, err)
		}
		if locator == "" {
			t.Errorf("No locator found after putting test data")
		}
	}

	// Create pullRequest for the test
	pullRequest := PullRequest{
		Locator: testData.Locator,
		Servers: servers,
	}
	return pullRequest
}
开发者ID:boratonAJ,项目名称:arvados,代码行数:48,代码来源:pull_worker_integration_test.go


示例11: Test_doMain

func (s *DoMainTestSuite) Test_doMain(c *C) {
	// Start keepservers.
	arvadostest.StartKeep(2, false)
	defer arvadostest.StopKeep(2)

	config := setupConfigFile(c, "config")
	defer os.Remove(config)

	locatorFile := setupBlockHashFile(c, "block-hash", []string{TestHash, TestHash2})
	defer os.Remove(locatorFile)

	args := []string{"-config", config, "-block-hash-file", locatorFile, "-v"}
	err := doMain(args)
	c.Check(err, NotNil)
	c.Assert(err.Error(), Equals, "Block verification failed for 2 out of 2 blocks with matching prefix.")
	checkErrorLog(c, []string{TestHash, TestHash2}, "Error verifying block", "Block not found")
	c.Assert(strings.Contains(logBuffer.String(), "Verifying block 1 of 2"), Equals, true)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:18,代码来源:keep-block-check_test.go


示例12: SetUpSuite

func (s *integrationSuite) SetUpSuite(c *check.C) {
	if testing.Short() {
		c.Skip("-short")
	}
	arvadostest.ResetEnv()
	arvadostest.StartAPI()
	arvadostest.StartKeep(4, true)

	arv, err := arvadosclient.MakeArvadosClient()
	arv.ApiToken = arvadostest.DataManagerToken
	c.Assert(err, check.IsNil)
	s.keepClient = &keepclient.KeepClient{
		Arvados: &arv,
		Client:  &http.Client{},
	}
	c.Assert(s.keepClient.DiscoverKeepServers(), check.IsNil)
	s.putReplicas(c, "foo", 4)
	s.putReplicas(c, "bar", 1)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:19,代码来源:integration_test.go


示例13: setupRsync

// Testing keep-rsync needs two sets of keep services: src and dst.
// The test setup hence creates 3 servers instead of the default 2,
// and uses the first 2 as src and the 3rd as dst keep servers.
func setupRsync(c *C, enforcePermissions bool, replications int) {
	// srcConfig
	var srcConfig apiConfig
	srcConfig.APIHost = os.Getenv("ARVADOS_API_HOST")
	srcConfig.APIToken = arvadostest.DataManagerToken
	srcConfig.APIHostInsecure = matchTrue.MatchString(os.Getenv("ARVADOS_API_HOST_INSECURE"))

	// dstConfig
	var dstConfig apiConfig
	dstConfig.APIHost = os.Getenv("ARVADOS_API_HOST")
	dstConfig.APIToken = arvadostest.DataManagerToken
	dstConfig.APIHostInsecure = matchTrue.MatchString(os.Getenv("ARVADOS_API_HOST_INSECURE"))

	if enforcePermissions {
		blobSigningKey = arvadostest.BlobSigningKey
	}

	// Start Keep servers
	arvadostest.StartKeep(3, enforcePermissions)

	// setup keepclients
	var err error
	kcSrc, _, err = setupKeepClient(srcConfig, srcKeepServicesJSON, false, 0, blobSignatureTTL)
	c.Check(err, IsNil)

	kcDst, _, err = setupKeepClient(dstConfig, dstKeepServicesJSON, true, replications, 0)
	c.Check(err, IsNil)

	for uuid := range kcSrc.LocalRoots() {
		if strings.HasSuffix(uuid, "02") {
			delete(kcSrc.LocalRoots(), uuid)
		}
	}
	for uuid := range kcSrc.GatewayRoots() {
		if strings.HasSuffix(uuid, "02") {
			delete(kcSrc.GatewayRoots(), uuid)
		}
	}
	for uuid := range kcSrc.WritableLocalRoots() {
		if strings.HasSuffix(uuid, "02") {
			delete(kcSrc.WritableLocalRoots(), uuid)
		}
	}

	for uuid := range kcDst.LocalRoots() {
		if strings.HasSuffix(uuid, "00") || strings.HasSuffix(uuid, "01") {
			delete(kcDst.LocalRoots(), uuid)
		}
	}
	for uuid := range kcDst.GatewayRoots() {
		if strings.HasSuffix(uuid, "00") || strings.HasSuffix(uuid, "01") {
			delete(kcDst.GatewayRoots(), uuid)
		}
	}
	for uuid := range kcDst.WritableLocalRoots() {
		if strings.HasSuffix(uuid, "00") || strings.HasSuffix(uuid, "01") {
			delete(kcDst.WritableLocalRoots(), uuid)
		}
	}

	if replications == 0 {
		// Must have got default replications value of 2 from dst discovery document
		c.Assert(kcDst.Want_replicas, Equals, 2)
	} else {
		// Since replications value is provided, it is used
		c.Assert(kcDst.Want_replicas, Equals, replications)
	}
}
开发者ID:pombredanne,项目名称:arvados,代码行数:71,代码来源:keep-rsync_test.go



注:本文中的git/curoverse/com/arvados/git/sdk/go/arvadostest.StartKeep函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang arvadostest.StopAPI函数代码示例发布时间:2022-05-24
下一篇:
Golang arvadostest.StartAPI函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap