Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(104)

Delta Between Two Patch Sets: agent/mongo/mongo_test.go

Issue 97370044: Added explicit --journal flag to mongod
Left Patch Set: Created 10 years, 11 months ago
Right Patch Set: Added explicit --journal flag to mongod Created 10 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « agent/mongo/mongo.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2014 Canonical Ltd. 1 // Copyright 2014 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package mongo 4 package mongo
5 5
6 import ( 6 import (
7 "encoding/base64" 7 "encoding/base64"
8 "fmt" 8 "fmt"
9 "io/ioutil" 9 "io/ioutil"
10 "os" 10 "os"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 func (s *MongoSuite) TestUpstartServiceWithHA(c *gc.C) { 214 func (s *MongoSuite) TestUpstartServiceWithHA(c *gc.C) {
215 dataDir := c.MkDir() 215 dataDir := c.MkDir()
216 216
217 svc, _, err := upstartService("", dataDir, dataDir, 1234, WithHA) 217 svc, _, err := upstartService("", dataDir, dataDir, 1234, WithHA)
218 c.Assert(err, gc.IsNil) 218 c.Assert(err, gc.IsNil)
219 c.Assert(strings.Contains(svc.Cmd, "--replSet"), jc.IsTrue) 219 c.Assert(strings.Contains(svc.Cmd, "--replSet"), jc.IsTrue)
220 220
221 svc, _, err = upstartService("", dataDir, dataDir, 1234, WithoutHA) 221 svc, _, err = upstartService("", dataDir, dataDir, 1234, WithoutHA)
222 c.Assert(err, gc.IsNil) 222 c.Assert(err, gc.IsNil)
223 c.Assert(strings.Contains(svc.Cmd, "--replSet"), jc.IsFalse) 223 c.Assert(strings.Contains(svc.Cmd, "--replSet"), jc.IsFalse)
224 }
225
226 func (s *MongoSuite) TestUpstartServiceWithJournal(c *gc.C) {
227 dataDir := c.MkDir()
228
229 svc, _, err := upstartService("", dataDir, dataDir, 1234, WithHA)
230 c.Assert(err, gc.IsNil)
231 journalPresent := strings.Contains(svc.Cmd, " --journal ") || strings.Ha sSuffix(svc.Cmd, " --journal")
232 c.Assert(journalPresent, jc.IsTrue)
233 }
234
235 func (s *MongoSuite) TestNoAuthCommandWithJournal(c *gc.C) {
236 dataDir := c.MkDir()
237
238 cmd, err := noauthCommand(dataDir, 1234)
239 c.Assert(err, gc.IsNil)
240 var isJournalPresent bool
241 for _, value := range cmd.Args {
242 if value == "--journal" {
243 isJournalPresent = true
244 }
245 }
246 c.Assert(isJournalPresent, jc.IsTrue)
224 } 247 }
225 248
226 func (s *MongoSuite) TestRemoveService(c *gc.C) { 249 func (s *MongoSuite) TestRemoveService(c *gc.C) {
227 err := RemoveService("namespace") 250 err := RemoveService("namespace")
228 c.Assert(err, gc.IsNil) 251 c.Assert(err, gc.IsNil)
229 c.Assert(s.removed, jc.DeepEquals, []upstart.Service{{ 252 c.Assert(s.removed, jc.DeepEquals, []upstart.Service{{
230 Name: "juju-db-namespace", 253 Name: "juju-db-namespace",
231 InitDir: upstart.InitDir, 254 InitDir: upstart.InitDir,
232 }}) 255 }})
233 } 256 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 420 }
398 421
399 // failCmd creates an executable file at the given location that will do nothing 422 // failCmd creates an executable file at the given location that will do nothing
400 // except return an error. 423 // except return an error.
401 func failCmd(path string) { 424 func failCmd(path string) {
402 err := ioutil.WriteFile(path, []byte("#!/bin/bash --norc\nexit 1"), 0755 ) 425 err := ioutil.WriteFile(path, []byte("#!/bin/bash --norc\nexit 1"), 0755 )
403 if err != nil { 426 if err != nil {
404 panic(err) 427 panic(err)
405 } 428 }
406 } 429 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b