本文整理汇总了Golang中git/curoverse/com/arvados/git/sdk/go/arvadostest.ResetEnv函数的典型用法代码示例。如果您正苦于以下问题:Golang ResetEnv函数的具体用法?Golang ResetEnv怎么用?Golang ResetEnv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResetEnv函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: SetUpTest
func (s *IntegrationSuite) SetUpTest(c *check.C) {
arvadostest.ResetEnv()
s.testServer = &server{}
var err error
address = "127.0.0.1:0"
err = s.testServer.Start()
c.Assert(err, check.Equals, nil)
}
开发者ID:pombredanne,项目名称:arvados,代码行数:8,代码来源:server_test.go
示例3: SetUpTest
func (s *IntegrationSuite) SetUpTest(c *check.C) {
arvadostest.ResetEnv()
s.testServer = &server{}
var err error
if s.tmpRepoRoot == "" {
s.tmpRepoRoot, err = ioutil.TempDir("", "arv-git-httpd")
c.Assert(err, check.Equals, nil)
}
s.tmpWorkdir, err = ioutil.TempDir("", "arv-git-httpd")
c.Assert(err, check.Equals, nil)
_, err = exec.Command("git", "init", "--bare", s.tmpRepoRoot+"/zzzzz-s0uqq-382brsig8rp3666.git").Output()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("git", "init", s.tmpWorkdir).Output()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("sh", "-c", "cd "+s.tmpWorkdir+" && echo initial >initial && git add initial && git -c user.name=Initial -c user.email=Initial commit -am 'foo: initial commit'").CombinedOutput()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("sh", "-c", "cd "+s.tmpWorkdir+" && git push "+s.tmpRepoRoot+"/zzzzz-s0uqq-382brsig8rp3666.git master:master").CombinedOutput()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("sh", "-c", "cd "+s.tmpWorkdir+" && echo work >work && git add work && git -c user.name=Foo -c user.email=Foo commit -am 'workdir: test'").CombinedOutput()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("git", "config",
"--file", s.tmpWorkdir+"/.git/config",
"credential.http://"+s.testServer.Addr+"/.helper",
"!cred(){ cat >/dev/null; if [ \"$1\" = get ]; then echo password=$ARVADOS_API_TOKEN; fi; };cred").Output()
c.Assert(err, check.Equals, nil)
_, err = exec.Command("git", "config",
"--file", s.tmpWorkdir+"/.git/config",
"credential.http://"+s.testServer.Addr+"/.username",
"none").Output()
c.Assert(err, check.Equals, nil)
if s.Config == nil {
s.Config = &config{
Addr: ":0",
GitCommand: "/usr/bin/git",
Root: s.tmpRepoRoot,
}
}
theConfig = s.Config
err = s.testServer.Start()
c.Assert(err, check.Equals, nil)
// Clear ARVADOS_API_TOKEN after starting up the server, to
// make sure arv-git-httpd doesn't use it.
os.Setenv("ARVADOS_API_TOKEN", "unused-token-placates-client-library")
}
开发者ID:Kunde21,项目名称:arvados,代码行数:47,代码来源:integration_test.go
示例4: 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
示例5: runProxy
func runProxy(c *C, args []string, port int, bogusClientToken bool) keepclient.KeepClient {
if bogusClientToken {
os.Setenv("ARVADOS_API_TOKEN", "bogus-token")
}
arv, err := arvadosclient.MakeArvadosClient()
c.Assert(err, Equals, nil)
kc := keepclient.KeepClient{
Arvados: &arv,
Want_replicas: 2,
Using_proxy: true,
Client: &http.Client{},
}
locals := map[string]string{
"proxy": fmt.Sprintf("http://localhost:%v", port),
}
writableLocals := map[string]string{
"proxy": fmt.Sprintf("http://localhost:%v", port),
}
kc.SetServiceRoots(locals, writableLocals, nil)
c.Check(kc.Using_proxy, Equals, true)
c.Check(len(kc.LocalRoots()), Equals, 1)
for _, root := range kc.LocalRoots() {
c.Check(root, Equals, fmt.Sprintf("http://localhost:%v", port))
}
log.Print("keepclient created")
if bogusClientToken {
arvadostest.ResetEnv()
}
{
os.Args = append(args, fmt.Sprintf("-listen=:%v", port))
listener = nil
go main()
}
return kc
}
开发者ID:brainstorm,项目名称:arvados,代码行数:37,代码来源:keepproxy_test.go
示例6: SetUpTest
func (s *NoKeepServerSuite) SetUpTest(c *C) {
arvadostest.ResetEnv()
}
开发者ID:Kunde21,项目名称:arvados,代码行数:3,代码来源:keepproxy_test.go
示例7: TearDownSuite
func (s *ServerRequiredSuite) TearDownSuite(c *C) {
arvadostest.StopAPI()
arvadostest.ResetEnv()
}
开发者ID:pombredanne,项目名称:arvados,代码行数:4,代码来源:keep-rsync_test.go
示例8: SetUpTest
func (s *MockArvadosServerSuite) SetUpTest(c *C) {
arvadostest.ResetEnv()
}
开发者ID:Kunde21,项目名称:arvados,代码行数:3,代码来源:arvadosclient_test.go
示例9: TearDownTest
func (s *MockArvadosServerSuite) TearDownTest(c *C) {
arvadostest.ResetEnv()
}
开发者ID:pombredanne,项目名称:arvados,代码行数:3,代码来源:crunch-dispatch-local_test.go
示例10: integrationTest
func (s *TestSuite) integrationTest(c *C,
newSqueueCmd func() *exec.Cmd,
sbatchCmdComps []string,
runContainer func(*dispatch.Dispatcher, dispatch.Container)) dispatch.Container {
arvadostest.ResetEnv()
arv, err := arvadosclient.MakeArvadosClient()
c.Assert(err, IsNil)
var sbatchCmdLine []string
// Override sbatchCmd
defer func(orig func(dispatch.Container) *exec.Cmd) {
sbatchCmd = orig
}(sbatchCmd)
sbatchCmd = func(container dispatch.Container) *exec.Cmd {
sbatchCmdLine = sbatchFunc(container).Args
return exec.Command("sh")
}
// Override squeueCmd
defer func(orig func() *exec.Cmd) {
squeueCmd = orig
}(squeueCmd)
squeueCmd = newSqueueCmd
// There should be no queued containers now
params := arvadosclient.Dict{
"filters": [][]string{[]string{"state", "=", "Queued"}},
}
var containers dispatch.ContainerList
err = arv.List("containers", params, &containers)
c.Check(err, IsNil)
c.Check(len(containers.Items), Equals, 1)
echo := "echo"
crunchRunCommand = &echo
doneProcessing := make(chan struct{})
dispatcher := dispatch.Dispatcher{
Arv: arv,
PollInterval: time.Duration(1) * time.Second,
RunContainer: func(dispatcher *dispatch.Dispatcher,
container dispatch.Container,
status chan dispatch.Container) {
go runContainer(dispatcher, container)
run(dispatcher, container, status)
doneProcessing <- struct{}{}
},
DoneProcessing: doneProcessing}
squeueUpdater.StartMonitor(time.Duration(500) * time.Millisecond)
err = dispatcher.RunDispatcher()
c.Assert(err, IsNil)
squeueUpdater.Done()
c.Check(sbatchCmdLine, DeepEquals, sbatchCmdComps)
// There should be no queued containers now
err = arv.List("containers", params, &containers)
c.Check(err, IsNil)
c.Check(len(containers.Items), Equals, 0)
// Previously "Queued" container should now be in "Complete" state
var container dispatch.Container
err = arv.Get("containers", "zzzzz-dz642-queuedcontainer", nil, &container)
c.Check(err, IsNil)
return container
}
开发者ID:pombredanne,项目名称:arvados,代码行数:71,代码来源:crunch-dispatch-slurm_test.go
注:本文中的git/curoverse/com/arvados/git/sdk/go/arvadostest.ResetEnv函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论