Exemplo n.º 1
0
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))
}
Exemplo n.º 2
0
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))
}
Exemplo n.º 3
0
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.*`)
}
Exemplo n.º 4
0
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)
}
Exemplo n.º 5
0
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), "")
}
Exemplo n.º 6
0
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)
}
Exemplo n.º 7
0
func (s *MongoSuite) TestNewServiceWithJournal(c *gc.C) {
	args := s.makeConfigArgs(c.MkDir())
	conf := mongo.NewConf(args)
	c.Assert(conf.ExecStart, gc.Matches, `.* --journal.*`)
}
Exemplo n.º 8
0
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)
}
Exemplo n.º 9
0
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), "")
}
Exemplo n.º 10
0
func (s *MongoSuite) TestNewServiceWithReplSet(c *gc.C) {
	conf := mongo.NewConf(s.makeConfigArgs(c.MkDir()))
	c.Assert(strings.Contains(conf.ExecStart, "--replSet"), jc.IsTrue)
}