本文整理汇总了Golang中github.com/wallyworld/core/provider/dummy.Reset函数的典型用法代码示例。如果您正苦于以下问题:Golang Reset函数的具体用法?Golang Reset怎么用?Golang Reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Reset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: tearDownConn
func (s *JujuConnSuite) tearDownConn(c *gc.C) {
serverAlive := testing.MgoServer.Addr() != ""
// 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 && serverAlive {
c.Logf("cannot reset admin password: %v", err)
}
err := s.Conn.Close()
if serverAlive {
c.Assert(err, gc.IsNil)
}
err = s.APIConn.Close()
if serverAlive {
c.Assert(err, gc.IsNil)
}
dummy.Reset()
s.Conn = nil
s.State = nil
osenv.SetHome(s.oldHome)
osenv.SetJujuHome(s.oldJujuHome)
s.oldHome = ""
s.RootDir = ""
}
开发者ID:jameinel,项目名称:core,代码行数:27,代码来源:conn.go
示例2: resetEnv
func (s *SimpleStreamsToolsSuite) resetEnv(c *gc.C, attrs map[string]interface{}) {
version.Current = s.origCurrentVersion
dummy.Reset()
cfg, err := config.New(config.NoDefaults, dummy.SampleConfig().Merge(attrs))
c.Assert(err, gc.IsNil)
env, err := environs.Prepare(cfg, testing.Context(c), configstore.NewMem())
c.Assert(err, gc.IsNil)
s.env = env
s.removeTools(c)
}
开发者ID:jameinel,项目名称:core,代码行数:10,代码来源:tools_test.go
示例3: makeEmptyFakeHome
// makeEmptyFakeHome creates a faked home without envtools.
func makeEmptyFakeHome(c *gc.C) (environs.Environ, *coretesting.FakeHome) {
fake := coretesting.MakeFakeHome(c, envConfig)
dummy.Reset()
store, err := configstore.Default()
c.Assert(err, gc.IsNil)
env, err := environs.PrepareFromName("peckham", nullContext(c), store)
c.Assert(err, gc.IsNil)
envtesting.RemoveAllTools(c, env)
return env, fake
}
开发者ID:jameinel,项目名称:core,代码行数:11,代码来源:bootstrap_test.go
示例4: TestBootstrapTools
func (s *bootstrapSuite) TestBootstrapTools(c *gc.C) {
allTests := append(envtesting.BootstrapToolsTests, bootstrapSetAgentVersionTests...)
// version.Current is set in the loop so ensure it is restored later.
s.PatchValue(&version.Current, version.Current)
for i, test := range allTests {
c.Logf("\ntest %d: %s", i, test.Info)
dummy.Reset()
attrs := dummy.SampleConfig().Merge(coretesting.Attrs{
"state-server": false,
"development": test.Development,
"default-series": test.DefaultSeries,
})
if test.AgentVersion != version.Zero {
attrs["agent-version"] = test.AgentVersion.String()
}
cfg, err := config.New(config.NoDefaults, attrs)
c.Assert(err, gc.IsNil)
env, err := environs.Prepare(cfg, coretesting.Context(c), configstore.NewMem())
c.Assert(err, gc.IsNil)
envtesting.RemoveAllTools(c, env)
version.Current = test.CliVersion
envtesting.AssertUploadFakeToolsVersions(c, env.Storage(), test.Available...)
// Remove the default tools URL from the search path, just look in cloud storage.
s.PatchValue(&envtools.DefaultBaseURL, "")
cons := constraints.Value{}
if test.Arch != "" {
cons = constraints.MustParse("arch=" + test.Arch)
}
err = bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{Constraints: cons})
if test.Err != "" {
c.Check(err, gc.NotNil)
if err != nil {
stripped := strings.Replace(err.Error(), "\n", "", -1)
c.Check(stripped, gc.Matches, ".*"+stripped)
}
continue
} else {
c.Check(err, gc.IsNil)
}
unique := map[version.Number]bool{}
for _, expected := range test.Expect {
unique[expected.Number] = true
}
for expectAgentVersion := range unique {
agentVersion, ok := env.Config().AgentVersion()
c.Check(ok, gc.Equals, true)
c.Check(agentVersion, gc.Equals, expectAgentVersion)
}
}
}
开发者ID:jameinel,项目名称:core,代码行数:52,代码来源:bootstrap_test.go
示例5: TestImageMetadataBadArgs
func (s *ImageMetadataSuite) TestImageMetadataBadArgs(c *gc.C) {
home := testing.MakeSampleHome(c)
s.AddCleanup(func(*gc.C) {
home.Restore()
dummy.Reset()
})
for i, t := range errTests {
c.Logf("test: %d", i)
ctx := testing.Context(c)
code := cmd.Main(&ImageMetadataCommand{}, ctx, t.args)
c.Check(code, gc.Equals, 1)
}
}
开发者ID:jameinel,项目名称:core,代码行数:13,代码来源:imagemetadata_test.go
示例6: TearDownTest
func (s *ConnSuite) TearDownTest(c *gc.C) {
if s.conn == nil {
return
}
err := s.conn.State.SetAdminMongoPassword("")
c.Assert(err, gc.IsNil)
err = s.conn.Environ.Destroy()
c.Check(err, gc.IsNil)
assertClose(c, s.conn)
s.conn = nil
dummy.Reset()
s.ToolsFixture.TearDownTest(c)
s.MgoSuite.TearDownTest(c)
s.LoggingSuite.TearDownTest(c)
}
开发者ID:jameinel,项目名称:core,代码行数:15,代码来源:conn_test.go
示例7: SetUpTest
func (s *ToolsMetadataSuite) SetUpTest(c *gc.C) {
s.LoggingSuite.SetUpTest(c)
s.home = coretesting.MakeSampleHome(c)
s.AddCleanup(func(*gc.C) {
s.home.Restore()
dummy.Reset()
loggo.ResetLoggers()
})
env, err := environs.PrepareFromName("erewhemos", coretesting.Context(c), configstore.NewMem())
c.Assert(err, gc.IsNil)
s.env = env
envtesting.RemoveAllTools(c, s.env)
loggo.GetLogger("").SetLogLevel(loggo.INFO)
// Switch the default tools location.
s.publicStorageDir = c.MkDir()
s.PatchValue(&tools.DefaultBaseURL, s.publicStorageDir)
}
开发者ID:jameinel,项目名称:core,代码行数:18,代码来源:toolsmetadata_test.go
示例8: TestAPIEndpointNotCached
func (s *APIEndpointForEnvSuite) TestAPIEndpointNotCached(c *gc.C) {
defer coretesting.MakeMultipleEnvHome(c).Restore()
store, err := configstore.Default()
c.Assert(err, gc.IsNil)
ctx := coretesting.Context(c)
env, err := environs.PrepareFromName("erewhemos", ctx, store)
c.Assert(err, gc.IsNil)
defer dummy.Reset()
envtesting.UploadFakeTools(c, env.Storage())
err = bootstrap.Bootstrap(ctx, env, environs.BootstrapParams{})
c.Assert(err, gc.IsNil)
// Note: if we get Bootstrap to start caching the API endpoint
// immediately, we'll still want to have this test for compatibility.
// We can just write blank info instead of reading and checking it is empty.
savedInfo, err := store.ReadInfo("erewhemos")
c.Assert(err, gc.IsNil)
// Ensure that the data isn't cached
c.Check(savedInfo.APIEndpoint().Addresses, gc.HasLen, 0)
called := 0
expectState := &mockAPIState{
apiHostPorts: [][]instance.HostPort{
instance.AddressesWithPort([]instance.Address{instance.NewAddress("0.1.2.3", instance.NetworkUnknown)}, 1234),
},
}
apiOpen := func(apiInfo *api.Info, opts api.DialOpts) (juju.APIState, error) {
c.Check(apiInfo.Tag, gc.Equals, "user-admin")
c.Check(string(apiInfo.CACert), gc.Equals, coretesting.CACert)
c.Check(apiInfo.Password, gc.Equals, coretesting.DefaultMongoPassword)
c.Check(opts, gc.DeepEquals, api.DefaultDialOpts())
called++
return expectState, nil
}
endpoint, err := juju.APIEndpointInStore("erewhemos", false, store, apiOpen)
c.Assert(err, gc.IsNil)
c.Assert(called, gc.Equals, 1)
c.Check(endpoint.Addresses, gc.DeepEquals, []string{"0.1.2.3:1234"})
}
开发者ID:jameinel,项目名称:core,代码行数:39,代码来源:apiconn_test.go
示例9: TearDownTest
func (s *suite) TearDownTest(c *gc.C) {
dummy.Reset()
s.LoggingSuite.TearDownTest(c)
}
开发者ID:jameinel,项目名称:core,代码行数:4,代码来源:config_test.go
示例10: TearDownTest
func (s *checkEnvironmentSuite) TearDownTest(c *gc.C) {
dummy.Reset()
}
开发者ID:jameinel,项目名称:core,代码行数:3,代码来源:open_test.go
示例11: TearDownTest
func (s *SimpleStreamsToolsSuite) TearDownTest(c *gc.C) {
dummy.Reset()
version.Current = s.origCurrentVersion
s.ToolsFixture.TearDownTest(c)
s.LoggingSuite.TearDownTest(c)
}
开发者ID:jameinel,项目名称:core,代码行数:6,代码来源:tools_test.go
示例12: TearDownTest
func (s *URLsSuite) TearDownTest(c *gc.C) {
dummy.Reset()
s.home.Restore()
}
开发者ID:jameinel,项目名称:core,代码行数:4,代码来源:urls_test.go
示例13: TearDownTest
func (s *ConfigSuite) TearDownTest(c *gc.C) {
s.LoggingSuite.TearDownTest(c)
dummy.Reset()
}
开发者ID:jameinel,项目名称:core,代码行数:4,代码来源:config_test.go
示例14: TearDownTest
func (s *BootstrapSuite) TearDownTest(c *gc.C) {
s.ToolsFixture.TearDownTest(c)
s.MgoSuite.TearDownTest(c)
s.LoggingSuite.TearDownTest(c)
dummy.Reset()
}
开发者ID:jameinel,项目名称:core,代码行数:6,代码来源:bootstrap_test.go
示例15: TearDownSuite
func (s *BootstrapSuite) TearDownSuite(c *gc.C) {
s.MgoSuite.TearDownSuite(c)
s.LoggingSuite.TearDownSuite(c)
dummy.Reset()
}
开发者ID:jameinel,项目名称:core,代码行数:5,代码来源:bootstrap_test.go
示例16: TearDownTest
func (s *syncToolsSuite) TearDownTest(c *gc.C) {
syncTools = s.origSyncTools
dummy.Reset()
s.home.Restore()
s.LoggingSuite.TearDownTest(c)
}
开发者ID:jameinel,项目名称:core,代码行数:6,代码来源:synctools_test.go
示例17: TearDownTest
func (s *environWatcherSuite) TearDownTest(c *gc.C) {
dummy.Reset()
s.LoggingSuite.TearDownTest(c)
}
开发者ID:jameinel,项目名称:core,代码行数:4,代码来源:environwatcher_test.go
示例18: TearDownTest
func (s *suite) TearDownTest(c *gc.C) {
s.Tests.TearDownTest(c)
dummy.Reset()
}
开发者ID:jameinel,项目名称:core,代码行数:4,代码来源:environs_test.go
示例19: TearDownTest
func (cs *NewAPIConnSuite) TearDownTest(c *gc.C) {
dummy.Reset()
cs.ToolsFixture.TearDownTest(c)
cs.LoggingSuite.TearDownTest(c)
}
开发者ID:jameinel,项目名称:core,代码行数:5,代码来源:apiconn_test.go
示例20: TearDownTest
func (s *uploadSuite) TearDownTest(c *gc.C) {
dummy.Reset()
s.ToolsFixture.TearDownTest(c)
s.LoggingSuite.TearDownTest(c)
}
开发者ID:jameinel,项目名称:core,代码行数:5,代码来源:sync_test.go
注:本文中的github.com/wallyworld/core/provider/dummy.Reset函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论