當前位置: 首頁>>代碼示例>>Golang>>正文


Golang bootstrap.EnsureNotBootstrapped函數代碼示例

本文整理匯總了Golang中github.com/juju/juju/environs/bootstrap.EnsureNotBootstrapped函數的典型用法代碼示例。如果您正苦於以下問題:Golang EnsureNotBootstrapped函數的具體用法?Golang EnsureNotBootstrapped怎麽用?Golang EnsureNotBootstrapped使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了EnsureNotBootstrapped函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestBootstrap

func (t *Tests) TestBootstrap(c *gc.C) {
	e := t.Prepare(c)
	t.UploadFakeTools(c, e.Storage())
	err := bootstrap.EnsureNotBootstrapped(e)
	c.Assert(err, gc.IsNil)
	err = bootstrap.Bootstrap(coretesting.Context(c), e, bootstrap.BootstrapParams{})
	c.Assert(err, gc.IsNil)

	stateServerInstances, err := e.StateServerInstances()
	c.Assert(err, gc.IsNil)
	c.Assert(stateServerInstances, gc.Not(gc.HasLen), 0)

	err = bootstrap.EnsureNotBootstrapped(e)
	c.Assert(err, gc.ErrorMatches, "environment is already bootstrapped")

	e2 := t.Open(c)
	t.UploadFakeTools(c, e2.Storage())
	err = bootstrap.EnsureNotBootstrapped(e2)
	c.Assert(err, gc.ErrorMatches, "environment is already bootstrapped")

	stateServerInstances2, err := e2.StateServerInstances()
	c.Assert(err, gc.IsNil)
	c.Assert(stateServerInstances2, gc.Not(gc.HasLen), 0)
	c.Assert(stateServerInstances2, jc.SameContents, stateServerInstances)

	err = environs.Destroy(e2, t.ConfigStore)
	c.Assert(err, gc.IsNil)

	// Prepare again because Destroy invalidates old environments.
	e3 := t.Prepare(c)
	t.UploadFakeTools(c, e3.Storage())

	err = bootstrap.EnsureNotBootstrapped(e3)
	c.Assert(err, gc.IsNil)
	err = bootstrap.Bootstrap(coretesting.Context(c), e3, bootstrap.BootstrapParams{})
	c.Assert(err, gc.IsNil)

	err = bootstrap.EnsureNotBootstrapped(e3)
	c.Assert(err, gc.ErrorMatches, "environment is already bootstrapped")

	err = environs.Destroy(e3, t.ConfigStore)
	c.Assert(err, gc.IsNil)
}
開發者ID:kapilt,項目名稱:juju,代碼行數:43,代碼來源:tests.go

示例2: TestBootstrap

func (t *Tests) TestBootstrap(c *gc.C) {
	e := t.Prepare(c)
	err := bootstrap.EnsureNotBootstrapped(e)
	c.Assert(err, jc.ErrorIsNil)
	err = bootstrap.Bootstrap(envtesting.BootstrapContext(c), e, bootstrap.BootstrapParams{})
	c.Assert(err, jc.ErrorIsNil)

	controllerInstances, err := e.ControllerInstances()
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(controllerInstances, gc.Not(gc.HasLen), 0)

	err = bootstrap.EnsureNotBootstrapped(e)
	c.Assert(err, gc.ErrorMatches, "model is already bootstrapped")

	e2 := t.Open(c)
	err = bootstrap.EnsureNotBootstrapped(e2)
	c.Assert(err, gc.ErrorMatches, "model is already bootstrapped")

	controllerInstances2, err := e2.ControllerInstances()
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(controllerInstances2, gc.Not(gc.HasLen), 0)
	c.Assert(controllerInstances2, jc.SameContents, controllerInstances)

	err = environs.Destroy(e2, t.ConfigStore)
	c.Assert(err, jc.ErrorIsNil)

	// Prepare again because Destroy invalidates old environments.
	e3 := t.Prepare(c)

	err = bootstrap.EnsureNotBootstrapped(e3)
	c.Assert(err, jc.ErrorIsNil)
	err = bootstrap.Bootstrap(envtesting.BootstrapContext(c), e3, bootstrap.BootstrapParams{})
	c.Assert(err, jc.ErrorIsNil)

	err = bootstrap.EnsureNotBootstrapped(e3)
	c.Assert(err, gc.ErrorMatches, "model is already bootstrapped")

	err = environs.Destroy(e3, t.ConfigStore)
	c.Assert(err, jc.ErrorIsNil)
}
開發者ID:exekias,項目名稱:juju,代碼行數:40,代碼來源:tests.go

示例3: bootstrapTestEnviron

func (s *suite) bootstrapTestEnviron(c *gc.C) environs.Environ {
	cfg, err := config.New(config.NoDefaults, s.TestConfig)
	c.Assert(err, gc.IsNil)
	e, err := environs.Prepare(cfg, testing.Context(c), s.ConfigStore)
	c.Assert(err, gc.IsNil, gc.Commentf("preparing environ %#v", s.TestConfig))
	c.Assert(e, gc.NotNil)

	envtesting.UploadFakeTools(c, e.Storage())
	err = bootstrap.EnsureNotBootstrapped(e)
	c.Assert(err, gc.IsNil)
	err = bootstrap.Bootstrap(testing.Context(c), e, environs.BootstrapParams{})
	c.Assert(err, gc.IsNil)
	return e
}
開發者ID:rogpeppe,項目名稱:juju,代碼行數:14,代碼來源:environs_test.go

示例4: TestBootstrapMultiple

func (t *LiveTests) TestBootstrapMultiple(c *gc.C) {
	// bootstrap.Bootstrap no longer raises errors if the environment is
	// already up, this has been moved into the bootstrap command.
	t.BootstrapOnce(c)

	err := bootstrap.EnsureNotBootstrapped(t.Env)
	c.Assert(err, gc.ErrorMatches, "environment is already bootstrapped")

	c.Logf("destroy env")
	env := t.Env
	t.Destroy(c)
	env.Destroy() // Again, should work fine and do nothing.

	// check that we can bootstrap after destroy
	t.BootstrapOnce(c)
}
開發者ID:klyachin,項目名稱:juju,代碼行數:16,代碼來源:livetests.go

示例5: bootstrapTestEnviron

func (s *suite) bootstrapTestEnviron(c *gc.C, preferIPv6 bool) environs.NetworkingEnviron {
	s.TestConfig["prefer-ipv6"] = preferIPv6
	cfg, err := config.New(config.NoDefaults, s.TestConfig)
	c.Assert(err, jc.ErrorIsNil)
	env, err := environs.Prepare(cfg, envtesting.BootstrapContext(c), s.ConfigStore)
	c.Assert(err, gc.IsNil, gc.Commentf("preparing environ %#v", s.TestConfig))
	c.Assert(env, gc.NotNil)
	netenv, supported := environs.SupportsNetworking(env)
	c.Assert(supported, jc.IsTrue)

	err = bootstrap.EnsureNotBootstrapped(netenv)
	c.Assert(err, jc.ErrorIsNil)
	err = bootstrap.Bootstrap(envtesting.BootstrapContext(c), netenv, bootstrap.BootstrapParams{})
	c.Assert(err, jc.ErrorIsNil)
	return netenv
}
開發者ID:imoapps,項目名稱:juju,代碼行數:16,代碼來源:environs_test.go

示例6: BootstrapOnce

func (t *LiveTests) BootstrapOnce(c *gc.C) {
	if t.bootstrapped {
		return
	}
	t.PrepareOnce(c)
	// We only build and upload tools if there will be a state agent that
	// we could connect to (actual live tests, rather than local-only)
	cons := constraints.MustParse("mem=2G")
	if t.CanOpenState {
		_, err := sync.Upload(t.toolsStorage, "released", nil, coretesting.FakeDefaultSeries)
		c.Assert(err, jc.ErrorIsNil)
	}
	err := bootstrap.EnsureNotBootstrapped(t.Env)
	c.Assert(err, jc.ErrorIsNil)
	err = bootstrap.Bootstrap(envtesting.BootstrapContext(c), t.Env, bootstrap.BootstrapParams{Constraints: cons})
	c.Assert(err, jc.ErrorIsNil)
	t.bootstrapped = true
}
開發者ID:Pankov404,項目名稱:juju,代碼行數:18,代碼來源:livetests.go

示例7: EnsureNotBootstrapped

func (b bootstrapFuncs) EnsureNotBootstrapped(env environs.Environ) error {
	return bootstrap.EnsureNotBootstrapped(env)
}
開發者ID:Pankov404,項目名稱:juju,代碼行數:3,代碼來源:bootstrap.go


注:本文中的github.com/juju/juju/environs/bootstrap.EnsureNotBootstrapped函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。