當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。