本文整理汇总了Golang中github.com/tsuru/tsuru/db/dbtest.ClearAllCollections函数的典型用法代码示例。如果您正苦于以下问题:Golang ClearAllCollections函数的具体用法?Golang ClearAllCollections怎么用?Golang ClearAllCollections使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ClearAllCollections函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: SetUpTest
func (s *S) SetUpTest(c *check.C) {
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
dbtest.ClearAllCollections(conn.Apps().Database)
os.Setenv("TSURU_TARGET", "http://localhost")
}
开发者ID:pedrosnk,项目名称:tsuru,代码行数:7,代码来源:suite_test.go
示例2: init
func init() {
suite := &routertest.RouterSuite{
SetUpSuiteFunc: func(c *check.C) {
config.Set("routers:galeb:username", "myusername")
config.Set("routers:galeb:password", "mypassword")
config.Set("routers:galeb:domain", "galeb.com")
config.Set("routers:galeb:type", "galeb")
config.Set("database:url", "127.0.0.1:27017")
config.Set("database:name", "router_galebv2_tests")
},
}
var server *httptest.Server
suite.SetUpTestFunc = func(c *check.C) {
handler, err := NewFakeGalebServer()
c.Assert(err, check.IsNil)
server = httptest.NewServer(handler)
config.Set("routers:galeb:api-url", server.URL+"/api")
gRouter, err := createRouter("routers:galeb")
c.Assert(err, check.IsNil)
suite.Router = gRouter
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
dbtest.ClearAllCollections(conn.Collection("router_galebv2_tests").Database)
}
suite.TearDownTestFunc = func(c *check.C) {
server.Close()
}
check.Suite(suite)
}
开发者ID:hermancaldara,项目名称:tsuru,代码行数:30,代码来源:router_test.go
示例3: SetUpTest
func (s *S) SetUpTest(c *check.C) {
config.Set("database:url", "127.0.0.1:27017")
config.Set("database:name", "tsuru_events_migrate_tests")
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
err = dbtest.ClearAllCollections(conn.Events().Database)
c.Assert(err, check.IsNil)
config.Set("routers:fake:type", "fake")
err = (&app.Plan{Name: "default", Router: "fake", CpuShare: 100, Default: true}).Save()
c.Assert(err, check.IsNil)
nativeScheme := auth.ManagedScheme(native.NativeScheme{})
app.AuthScheme = nativeScheme
s.user = &auth.User{Email: "[email protected]", Password: "123456"}
_, err = nativeScheme.Create(s.user)
c.Assert(err, check.IsNil)
s.team = &auth.Team{Name: "angra"}
err = conn.Teams().Insert(s.team)
c.Assert(err, check.IsNil)
provision.DefaultProvisioner = "fake"
provisiontest.ProvisionerInstance.Reset()
opts := provision.AddPoolOptions{Name: "test1", Default: true}
err = provision.AddPool(opts)
c.Assert(err, check.IsNil)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:25,代码来源:migrate_test.go
示例4: SetUpTest
func (s *S) SetUpTest(c *check.C) {
routertest.FakeRouter.Reset()
rand.Seed(0)
config.Set("swarm:swarm-port", 0)
err := dbtest.ClearAllCollections(s.conn.Apps().Database)
c.Assert(err, check.IsNil)
err = provision.AddPool(provision.AddPoolOptions{Name: "bonehunters", Default: true, Provisioner: "swarm"})
c.Assert(err, check.IsNil)
p := app.Plan{
Name: "default",
Router: "fake",
Default: true,
CpuShare: 100,
}
err = p.Save()
c.Assert(err, check.IsNil)
s.p = &swarmProvisioner{}
err = s.p.Initialize()
c.Assert(err, check.IsNil)
s.user = &auth.User{Email: "[email protected]", Password: "123456", Quota: quota.Unlimited}
nativeScheme := auth.ManagedScheme(native.NativeScheme{})
app.AuthScheme = nativeScheme
_, err = nativeScheme.Create(s.user)
c.Assert(err, check.IsNil)
s.team = &auth.Team{Name: "admin"}
c.Assert(err, check.IsNil)
err = s.conn.Teams().Insert(s.team)
c.Assert(err, check.IsNil)
s.token, err = nativeScheme.Login(map[string]string{"email": s.user.Email, "password": "123456"})
c.Assert(err, check.IsNil)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:31,代码来源:suite_test.go
示例5: SetUpTest
func (s *InstanceSuite) SetUpTest(c *check.C) {
dbtest.ClearAllCollections(s.conn.Apps().Database)
s.user = &auth.User{Email: "[email protected]", Password: "123"}
s.team = &auth.Team{Name: "Raul"}
s.conn.Users().Insert(s.user)
s.conn.Teams().Insert(s.team)
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:7,代码来源:service_instance_test.go
示例6: TearDownTest
func (s *S) TearDownTest(c *check.C) {
err := dbtest.ClearAllCollections(s.conn.Users().Database)
c.Assert(err, check.IsNil)
s.conn.Close()
cost = 0
tokenExpire = 0
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:7,代码来源:suite_test.go
示例7: SetUpTest
func (s *ConsumptionSuite) SetUpTest(c *check.C) {
repositorytest.Reset()
config.Set("database:url", "127.0.0.1:27017")
config.Set("database:name", "tsuru_api_consumption_test")
config.Set("auth:hash-cost", 4)
config.Set("repo-manager", "fake")
var err error
s.conn, err = db.Conn()
c.Assert(err, check.IsNil)
dbtest.ClearAllCollections(s.conn.Apps().Database)
s.team = &auth.Team{Name: "tsuruteam"}
err = s.conn.Teams().Insert(s.team)
c.Assert(err, check.IsNil)
s.token = customUserWithPermission(c, "consumption-master-user", permission.Permission{
Scheme: permission.PermServiceInstance,
Context: permission.Context(permission.CtxTeam, s.team.Name),
}, permission.Permission{
Scheme: permission.PermServiceRead,
Context: permission.Context(permission.CtxTeam, s.team.Name),
})
s.user, err = s.token.User()
c.Assert(err, check.IsNil)
app.AuthScheme = nativeScheme
s.provisioner = provisiontest.NewFakeProvisioner()
app.Provisioner = s.provisioner
}
开发者ID:reoring,项目名称:tsuru,代码行数:26,代码来源:service_consumption_test.go
示例8: SetUpTest
func (s *S) SetUpTest(c *check.C) {
routertest.FakeRouter.Reset()
repositorytest.Reset()
var err error
s.conn, err = db.Conn()
c.Assert(err, check.IsNil)
dbtest.ClearAllCollections(s.conn.Apps().Database)
s.logConn, err = db.LogConn()
c.Assert(err, check.IsNil)
s.createUserAndTeam(c)
s.provisioner = provisiontest.NewFakeProvisioner()
app.Provisioner = s.provisioner
app.AuthScheme = nativeScheme
p := app.Platform{Name: "zend"}
s.conn.Platforms().Insert(p)
s.Pool = "test1"
opts := provision.AddPoolOptions{Name: "test1", Default: true}
err = provision.AddPool(opts)
c.Assert(err, check.IsNil)
repository.Manager().CreateUser(s.user.Email)
repository.Manager().CreateUser(s.adminuser.Email)
factory, err := queue.Factory()
c.Assert(err, check.IsNil)
factory.Reset()
}
开发者ID:nicolas2bonfils,项目名称:tsuru,代码行数:25,代码来源:suite_test.go
示例9: SetUpTest
func (s *S) SetUpTest(c *check.C) {
queue.ResetQueue()
err := rebuild.RegisterTask(func(appName string) (rebuild.RebuildApp, error) {
a, err := app.GetByName(appName)
if err == app.ErrAppNotFound {
return nil, nil
}
return a, err
})
c.Assert(err, check.IsNil)
routertest.FakeRouter.Reset()
provisiontest.ProvisionerInstance.Reset()
err = dbtest.ClearAllCollections(s.conn.Apps().Database)
c.Assert(err, check.IsNil)
s.user = &auth.User{Email: "[email protected]", Password: "123456", Quota: quota.Unlimited}
nativeScheme := auth.ManagedScheme(native.NativeScheme{})
app.AuthScheme = nativeScheme
_, err = nativeScheme.Create(s.user)
c.Assert(err, check.IsNil)
s.team = &auth.Team{Name: "admin"}
c.Assert(err, check.IsNil)
err = s.conn.Teams().Insert(s.team)
c.Assert(err, check.IsNil)
err = provision.AddPool(provision.AddPoolOptions{
Name: "p1",
Default: true,
Provisioner: "fake",
})
c.Assert(err, check.IsNil)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:30,代码来源:suite_test.go
示例10: SetUpTest
func (s *ActionsSuite) SetUpTest(c *check.C) {
var err error
s.conn, err = db.Conn()
c.Assert(err, check.IsNil)
dbtest.ClearAllCollections(s.conn.Apps().Database)
repositorytest.Reset()
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:7,代码来源:actions_test.go
示例11: SetUpTest
func (s *S) SetUpTest(c *check.C) {
s.provisioner.Reset()
repositorytest.Reset()
dbtest.ClearAllCollections(s.conn.Apps().Database)
s.createUserAndTeam(c)
platform := Platform{Name: "python"}
s.conn.Platforms().Insert(platform)
s.defaultPlan = Plan{
Name: "default-plan",
Memory: 1024,
Swap: 1024,
CpuShare: 100,
Default: true,
}
err := s.conn.Plans().Insert(s.defaultPlan)
c.Assert(err, check.IsNil)
s.Pool = "pool1"
opts := provision.AddPoolOptions{Name: s.Pool}
err = provision.AddPool(opts)
c.Assert(err, check.IsNil)
repository.Manager().CreateUser(s.user.Email)
factory, err := queue.Factory()
c.Assert(err, check.IsNil)
factory.Reset()
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:25,代码来源:suite_test.go
示例12: init
func init() {
suite := &routertest.RouterSuite{
SetUpSuiteFunc: func(c *check.C) {
config.Set("routers:fusis:domain", "fusis.com")
config.Set("routers:fusis:type", "fusis")
config.Set("database:url", "127.0.0.1:27017")
config.Set("database:name", "router_fusis_tests")
},
}
var fakeServer *fusisTesting.FakeFusisServer
suite.SetUpTestFunc = func(c *check.C) {
var err error
fakeServer = fusisTesting.NewFakeFusisServer()
config.Set("routers:fusis:api-url", fakeServer.URL)
fRouter, err := createRouter("fusis", "routers:fusis")
c.Assert(err, check.IsNil)
suite.Router = fRouter
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
dbtest.ClearAllCollections(conn.Collection("router_fusis_tests").Database)
}
suite.TearDownTestFunc = func(c *check.C) {
fakeServer.Close()
}
check.Suite(suite)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:27,代码来源:fusis_test.go
示例13: TearDownSuite
func (s *S) TearDownSuite(c *check.C) {
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
err = dbtest.ClearAllCollections(conn.Apps().Database)
c.Assert(err, check.IsNil)
s.server.Stop()
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:8,代码来源:suite_test.go
示例14: SetUpTest
func (s *BindSuite) SetUpTest(c *check.C) {
routertest.FakeRouter.Reset()
dbtest.ClearAllCollections(s.conn.Apps().Database)
s.user = auth.User{Email: "[email protected]"}
s.user.Create()
s.team = auth.Team{Name: "metallica", Users: []string{s.user.Email}}
s.conn.Teams().Insert(s.team)
}
开发者ID:edulemasson,项目名称:tsuru,代码行数:8,代码来源:bind_test.go
示例15: SetUpTest
func (s *S) SetUpTest(c *check.C) {
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
err = dbtest.ClearAllCollections(conn.Apps().Database)
c.Assert(err, check.IsNil)
routertest.FakeRouter.Reset()
}
开发者ID:tsuru,项目名称:tsuru,代码行数:8,代码来源:fake_provisioner_test.go
示例16: SetUpTest
func (s *S) SetUpTest(c *check.C) {
config.ReadConfigFile("testdata/tsuru.conf")
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
dbtest.ClearAllCollections(conn.Apps().Database)
repositorytest.Reset()
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:8,代码来源:suite_test.go
示例17: SetUpTest
func (s *PlatformSuite) SetUpTest(c *check.C) {
provisiontest.ExtensibleInstance.Reset()
repositorytest.Reset()
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
dbtest.ClearAllCollections(conn.Apps().Database)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:8,代码来源:platform_test.go
示例18: SetUpTest
func (s *PlatformSuite) SetUpTest(c *check.C) {
config.Set("database:url", "127.0.0.1:27017")
config.Set("database:name", "tsuru_api_platform_test")
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
dbtest.ClearAllCollections(conn.Apps().Database)
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:8,代码来源:platform_test.go
示例19: TearDownSuite
func (s *HandlersSuite) TearDownSuite(c *check.C) {
s.clusterSess.Close()
coll := mainDockerProvisioner.collection()
defer coll.Close()
err := dbtest.ClearAllCollections(coll.Database)
c.Assert(err, check.IsNil)
s.conn.Close()
}
开发者ID:mderaldo,项目名称:tsuru,代码行数:8,代码来源:handlers_test.go
示例20: SetUpTest
func (s *LimiterSuite) SetUpTest(c *check.C) {
config.Set("database:url", "127.0.0.1:27017")
config.Set("database:name", "provision_limiter_tests_s")
conn, err := db.Conn()
c.Assert(err, check.IsNil)
defer conn.Close()
err = dbtest.ClearAllCollections(conn.Apps().Database)
c.Assert(err, check.IsNil)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:9,代码来源:limiter_test.go
注:本文中的github.com/tsuru/tsuru/db/dbtest.ClearAllCollections函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论