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)) }
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)) }
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.*`) }
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) }
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), "") }
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) }
func (s *MongoSuite) TestNewServiceWithJournal(c *gc.C) { args := s.makeConfigArgs(c.MkDir()) conf := mongo.NewConf(args) c.Assert(conf.ExecStart, gc.Matches, `.* --journal.*`) }
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) }
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), "") }
func (s *MongoSuite) TestNewServiceWithReplSet(c *gc.C) { conf := mongo.NewConf(s.makeConfigArgs(c.MkDir())) c.Assert(strings.Contains(conf.ExecStart, "--replSet"), jc.IsTrue) }