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


Golang dummy.Reset函数代码示例

本文整理汇总了Golang中launchpad/net/juju-core/environs/dummy.Reset函数的典型用法代码示例。如果您正苦于以下问题:Golang Reset函数的具体用法?Golang Reset怎么用?Golang Reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: tearDownTest

func (s *syncSuite) tearDownTest(c *gc.C) {
	c.Assert(s.storage.Stop(), gc.IsNil)
	sync.DefaultToolsLocation = s.origLocation
	dummy.Reset()
	s.home.Restore()
	version.Current = s.origVersion
	s.LoggingSuite.TearDownTest(c)
}
开发者ID:hivetech,项目名称:judo.legacy,代码行数:8,代码来源:sync_test.go

示例2: makeEmptyFakeHome

// makeEmptyFakeHome creates a faked home without tools.
func makeEmptyFakeHome(c *gc.C) (environs.Environ, *coretesting.FakeHome) {
	fake := coretesting.MakeFakeHome(c, envConfig)
	dummy.Reset()
	env, err := environs.NewFromName("peckham")
	c.Assert(err, gc.IsNil)
	envtesting.RemoveAllTools(c, env)
	return env, fake
}
开发者ID:hivetech,项目名称:judo.legacy,代码行数:9,代码来源:bootstrap_test.go

示例3: TearDownTest

func (s *ConnSuite) TearDownTest(c *C) {
	if s.conn == nil {
		return
	}
	err := s.conn.State.SetAdminMongoPassword("")
	c.Assert(err, IsNil)
	err = s.conn.Environ.Destroy(nil)
	c.Check(err, IsNil)
	s.conn.Close()
	s.conn = nil
	dummy.Reset()
	s.MgoSuite.TearDownTest(c)
	s.LoggingSuite.TearDownTest(c)
}
开发者ID:rif,项目名称:golang-stuff,代码行数:14,代码来源:conn_test.go

示例4: tearDownConn

func (s *JujuConnSuite) tearDownConn(c *C) {
	// Bootstrap will set the admin password, and render non-authorized use
	// impossible. s.State may still hold the right password, so try to reset
	// the password so that the MgoSuite soft-resetting works. If that fails,
	// it will still work, but it will take a while since it has to kill the
	// whole database and start over.
	if err := s.State.SetAdminMongoPassword(""); err != nil {
		c.Logf("cannot reset admin password: %v", err)
	}
	c.Assert(s.Conn.Close(), IsNil)
	dummy.Reset()
	s.Conn = nil
	s.State = nil
	os.Setenv("HOME", s.oldHome)
	s.oldHome = ""
	s.RootDir = ""
}
开发者ID:prabhakhar,项目名称:juju-core,代码行数:17,代码来源:conn.go

示例5: Reset

func (s *ToolsSuite) Reset(c *C, attrs map[string]interface{}) {
	version.Current = s.origCurrentVersion
	dummy.Reset()
	final := map[string]interface{}{
		"name":            "test",
		"type":            "dummy",
		"state-server":    false,
		"authorized-keys": "i-am-a-key",
		"ca-cert":         testing.CACert,
		"ca-private-key":  "",
	}
	for k, v := range attrs {
		final[k] = v
	}
	env, err := environs.NewFromAttrs(final)
	c.Assert(err, IsNil)
	s.env = env
	envtesting.RemoveAllTools(c, s.env)
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:19,代码来源:tools_test.go

示例6: runCommand

func runCommand(com cmd.Command, args ...string) (opc chan dummy.Operation, errc chan error) {
	errc = make(chan error, 1)
	opc = make(chan dummy.Operation, 200)
	dummy.Reset()
	dummy.Listen(opc)
	go func() {
		// signal that we're done with this ops channel.
		defer dummy.Listen(nil)

		err := com.Init(newFlagSet(), args)
		if err != nil {
			errc <- err
			return
		}

		err = com.Run(cmd.DefaultContext())
		errc <- err
	}()
	return
}
开发者ID:prabhakhar,项目名称:juju-core,代码行数:20,代码来源:cmd_test.go

示例7: TearDownTest

func (s *StorageSuite) TearDownTest(c *gc.C) {
	dummy.Reset()
	s.LoggingSuite.TearDownTest(c)
}
开发者ID:hivetech,项目名称:judo.legacy,代码行数:4,代码来源:storage_test.go

示例8: TearDownTest

func (OpenSuite) TearDownTest(c *C) {
	dummy.Reset()
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:3,代码来源:open_test.go

示例9: TearDownTest

func (s *ToolsSuite) TearDownTest(c *C) {
	dummy.Reset()
	version.Current = s.origCurrentVersion
	s.LoggingSuite.TearDownTest(c)
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:5,代码来源:tools_test.go

示例10: TearDownTest

func (s *verifyStorageSuite) TearDownTest(c *C) {
	dummy.Reset()
}
开发者ID:rif,项目名称:golang-stuff,代码行数:3,代码来源:emptystorage_test.go

示例11: TearDownTest

func (t *MongoToolsSuite) TearDownTest(c *C) {
	dummy.Reset()
	t.LoggingSuite.TearDownTest(c)
}
开发者ID:rif,项目名称:golang-stuff,代码行数:4,代码来源:mongo_test.go

示例12: TearDownTest

func (s *syncToolsSuite) TearDownTest(c *gc.C) {
	syncTools = s.origSyncTools
	dummy.Reset()
	s.home.Restore()
	s.LoggingSuite.TearDownTest(c)
}
开发者ID:hivetech,项目名称:judo.legacy,代码行数:6,代码来源:synctools_test.go

示例13: TearDownTest

func (s *BootstrapSuite) TearDownTest(c *C) {
	s.MgoSuite.TearDownTest(c)
	s.LoggingSuite.TearDownTest(c)
	dummy.Reset()
}
开发者ID:prabhakhar,项目名称:juju-core,代码行数:5,代码来源:bootstrap_test.go

示例14: run

func (test bootstrapTest) run(c *C) {
	defer testing.MakeFakeHome(c, envConfig).Restore()
	dummy.Reset()
	env, err := environs.NewFromName("peckham")
	c.Assert(err, IsNil)
	envtesting.RemoveAllTools(c, env)

	if test.version != "" {
		origVersion := version.Current
		version.Current = version.MustParseBinary(test.version)
		defer func() { version.Current = origVersion }()
	}
	uploadCount := len(test.uploads)
	if uploadCount == 0 {
		usefulVersion := version.Current
		usefulVersion.Series = env.Config().DefaultSeries()
		envtesting.UploadFakeToolsVersion(c, env.Storage(), usefulVersion)
	}

	// Run command and check for uploads.
	opc, errc := runCommand(new(BootstrapCommand), test.args...)
	if uploadCount > 0 {
		for i := 0; i < uploadCount; i++ {
			c.Check((<-opc).(dummy.OpPutFile).Env, Equals, "peckham")
		}
		list, err := environs.FindAvailableTools(env, version.Current.Major)
		c.Check(err, IsNil)
		c.Logf("found: " + list.String())
		urls := list.URLs()
		c.Check(urls, HasLen, len(test.uploads))
		for _, v := range test.uploads {
			c.Logf("seeking: " + v)
			vers := version.MustParseBinary(v)
			_, found := urls[vers]
			c.Check(found, Equals, true)
		}
	}

	// Check for remaining operations/errors.
	if test.err != "" {
		c.Check(<-errc, ErrorMatches, test.err)
		return
	}
	if !c.Check(<-errc, IsNil) {
		return
	}
	opPutBootstrapVerifyFile := (<-opc).(dummy.OpPutFile)
	c.Check(opPutBootstrapVerifyFile.Env, Equals, "peckham")
	c.Check(opPutBootstrapVerifyFile.FileName, Equals, "bootstrap-verify")

	opBootstrap := (<-opc).(dummy.OpBootstrap)
	c.Check(opBootstrap.Env, Equals, "peckham")
	c.Check(opBootstrap.Constraints, DeepEquals, test.constraints)

	// Check a CA cert/key was generated by reloading the environment.
	env, err = environs.NewFromName("peckham")
	c.Assert(err, IsNil)
	_, hasCert := env.Config().CACert()
	c.Check(hasCert, Equals, true)
	_, hasKey := env.Config().CAPrivateKey()
	c.Check(hasKey, Equals, true)
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:62,代码来源:bootstrap_test.go

示例15: TearDownTest

func (suite) TearDownTest(c *C) {
	dummy.Reset()
}
开发者ID:hivetech,项目名称:judo.legacy,代码行数:3,代码来源:config_test.go


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