本文整理汇总了Golang中github.com/juju/juju/mongo.NewConf函数的典型用法代码示例。如果您正苦于以下问题:Golang NewConf函数的具体用法?Golang NewConf怎么用?Golang NewConf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewConf函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestNewConf
func (s *serviceSuite) TestNewConf(c *gc.C) {
dataDir := "/var/lib/juju"
dbDir := dataDir + "/db"
mongodPath := "/mgo/bin/mongod"
port := 12345
oplogSizeMB := 10
conf := mongo.NewConf(dataDir, dbDir, mongodPath, port, oplogSizeMB, false)
expected := common.Conf{
Desc: "juju state database",
Limit: map[string]int{
"nofile": 65000,
"nproc": 20000,
},
Timeout: 300,
ExecStart: "/mgo/bin/mongod" +
" --auth" +
" --dbpath '/var/lib/juju/db'" +
" --sslOnNormalPorts" +
" --sslPEMKeyFile '/var/lib/juju/server.pem'" +
" --sslPEMKeyPassword ignored" +
" --port 12345" +
" --noprealloc" +
" --syslog" +
" --smallfiles" +
" --journal" +
" --keyFile '/var/lib/juju/shared-secret'" +
" --replSet juju" +
" --ipv6" +
" --oplogSize 10",
}
c.Check(conf, jc.DeepEquals, expected)
c.Check(strings.Fields(conf.ExecStart), jc.DeepEquals, strings.Fields(expected.ExecStart))
}
示例2: TestNewConf
func (s *serviceSuite) TestNewConf(c *gc.C) {
dataDir := "/var/lib/juju"
dbDir := dataDir + "/db"
mongodPath := "/mgo/bin/mongod"
mongodVersion := mongo.Mongo24
port := 12345
oplogSizeMB := 10
conf := mongo.NewConf(mongo.ConfigArgs{
DataDir: dataDir,
DBDir: dbDir,
MongoPath: mongodPath,
Port: port,
OplogSizeMB: oplogSizeMB,
WantNumaCtl: false,
Version: mongodVersion,
Auth: true,
IPv6: true,
})
expected := common.Conf{
Desc: "juju state database",
Limit: map[string]int{
"nofile": 65000,
"nproc": 20000,
},
Timeout: 300,
ExecStart: "/mgo/bin/mongod" +
" --dbpath '/var/lib/juju/db'" +
" --sslOnNormalPorts" +
" --sslPEMKeyFile '/var/lib/juju/server.pem'" +
" --sslPEMKeyPassword=ignored" +
" --port 12345" +
" --syslog" +
" --journal" +
" --replSet juju" +
" --quiet" +
" --oplogSize 10" +
" --ipv6" +
" --auth" +
" --keyFile '/var/lib/juju/shared-secret'" +
" --noprealloc" +
" --smallfiles",
}
c.Check(conf, jc.DeepEquals, expected)
c.Check(strings.Fields(conf.ExecStart), jc.DeepEquals, strings.Fields(expected.ExecStart))
}
示例3: TestNewServiceWithJournal
func (s *MongoSuite) TestNewServiceWithJournal(c *gc.C) {
dataDir := c.MkDir()
conf := mongo.NewConf(dataDir, dataDir, mongo.JujuMongod24Path, 1234, 1024, false, s.mongodVersion, true)
c.Assert(conf.ExecStart, gc.Matches, `.* --journal.*`)
}
示例4: TestNewServiceIPv6
func (s *MongoSuite) TestNewServiceIPv6(c *gc.C) {
dataDir := c.MkDir()
conf := mongo.NewConf(dataDir, dataDir, mongo.JujuMongod24Path, 1234, 1024, false, s.mongodVersion, true)
c.Assert(strings.Contains(conf.ExecStart, "--ipv6"), jc.IsTrue)
}
示例5: TestNewServiceWithNumCtl
func (s *MongoSuite) TestNewServiceWithNumCtl(c *gc.C) {
dataDir := c.MkDir()
conf := mongo.NewConf(dataDir, dataDir, mongo.JujuMongod24Path, 1234, 1024, true, s.mongodVersion, true)
c.Assert(conf.ExtraScript, gc.Not(gc.Matches), "")
}
示例6: TestNewServiceWithReplSet
func (s *MongoSuite) TestNewServiceWithReplSet(c *gc.C) {
dataDir := c.MkDir()
conf := mongo.NewConf(dataDir, dataDir, mongo.JujuMongodPath, 1234, 1024, false)
c.Assert(strings.Contains(conf.ExecStart, "--replSet"), jc.IsTrue)
}
示例7: TestNewServiceWithJournal
func (s *MongoSuite) TestNewServiceWithJournal(c *gc.C) {
args := s.makeConfigArgs(c.MkDir())
conf := mongo.NewConf(args)
c.Assert(conf.ExecStart, gc.Matches, `.* --journal.*`)
}
示例8: TestNewServiceWithoutIPv6
func (s *MongoSuite) TestNewServiceWithoutIPv6(c *gc.C) {
args := s.makeConfigArgs(c.MkDir())
args.IPv6 = false
conf := mongo.NewConf(args)
c.Assert(strings.Contains(conf.ExecStart, "--ipv6"), jc.IsFalse)
}
示例9: TestNewServiceWithNumCtl
func (s *MongoSuite) TestNewServiceWithNumCtl(c *gc.C) {
args := s.makeConfigArgs(c.MkDir())
args.WantNUMACtl = true
conf := mongo.NewConf(args)
c.Assert(conf.ExtraScript, gc.Not(gc.Matches), "")
}
示例10: TestNewServiceWithReplSet
func (s *MongoSuite) TestNewServiceWithReplSet(c *gc.C) {
conf := mongo.NewConf(s.makeConfigArgs(c.MkDir()))
c.Assert(strings.Contains(conf.ExecStart, "--replSet"), jc.IsTrue)
}