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


Golang mongo.NewConf函数代码示例

本文整理汇总了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))
}
开发者ID:imoapps,项目名称:juju,代码行数:34,代码来源:service_test.go

示例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))
}
开发者ID:kat-co,项目名称:juju,代码行数:47,代码来源:service_test.go

示例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.*`)
}
开发者ID:xushiwei,项目名称:juju,代码行数:6,代码来源:mongo_test.go

示例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)
}
开发者ID:xushiwei,项目名称:juju,代码行数:6,代码来源:mongo_test.go

示例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), "")
}
开发者ID:xushiwei,项目名称:juju,代码行数:6,代码来源:mongo_test.go

示例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)
}
开发者ID:Pankov404,项目名称:juju,代码行数:6,代码来源:mongo_test.go

示例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.*`)
}
开发者ID:bac,项目名称:juju,代码行数:5,代码来源:mongo_test.go

示例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)
}
开发者ID:bac,项目名称:juju,代码行数:6,代码来源:mongo_test.go

示例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), "")
}
开发者ID:bac,项目名称:juju,代码行数:6,代码来源:mongo_test.go

示例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)
}
开发者ID:bac,项目名称:juju,代码行数:4,代码来源:mongo_test.go


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