Merge lp:~cmars/juju-core/cs-mongo-tests into lp:~go-bot/juju-core/trunk

Proposed by Casey Marshall
Status: Merged
Approved by: Casey Marshall
Approved revision: no longer in the source branch.
Merged at revision: 2609
Proposed branch: lp:~cmars/juju-core/cs-mongo-tests
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 173 lines (+62/-0)
3 files modified
CONTRIBUTING (+13/-0)
store/server_test.go (+16/-0)
store/store_test.go (+33/-0)
To merge this branch: bzr merge lp:~cmars/juju-core/cs-mongo-tests
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+213563@code.launchpad.net

Commit message

Disable charm store tests that require Mongo JS.

Juju CI tests run against a build of MongoDB that does not support javascript
for cross-platform reasons. This causes some of the charm store tests to fail
which use map reduce to test the stats collection. Made the execution of these
tests configurable with a -mongojs suite flag, off by default.

https://codereview.appspot.com/82930043/

Description of the change

Disable charm store tests that require Mongo JS.

Juju CI tests run against a build of MongoDB that does not support javascript
for cross-platform reasons. This causes some of the charm store tests to fail
which use map reduce to test the stats collection. Made the execution of these
tests configurable with a -mongojs suite flag, off by default.

https://codereview.appspot.com/82930043/

To post a comment you must log in.
Revision history for this message
Casey Marshall (cmars) wrote :
Download full text (3.6 KiB)

Reviewers: mp+213563_code.launchpad.net,

Message:
Please take a look.

Description:
Disable charm store tests that require Mongo JS.

Juju CI tests run against a build of MongoDB that does not support
javascript
for cross-platform reasons. This causes some of the charm store tests to
fail
which use map reduce to test the stats collection. Made the execution of
these
tests configurable with a -mongojs suite flag, off by default.

https://code.launchpad.net/~cmars/juju-core/cs-mongo-tests/+merge/213563

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/82930043/

Affected files (+33, -0 lines):
   A [revision details]
   M store/server_test.go
   M store/store_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140331232430-drvjtzkduheba0pm
+New revision: <email address hidden>

Index: store/server_test.go
=== modified file 'store/server_test.go'
--- store/server_test.go 2014-03-27 05:00:05 +0000
+++ store/server_test.go 2014-04-01 00:11:10 +0000
@@ -203,6 +203,10 @@
  // checkCounterSum checks that statistics are properly collected.
  // It retries a few times as they are generally collected in background.
  func (s *StoreSuite) checkCounterSum(c *gc.C, key []string, prefix bool,
expected int64) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
   var sum int64
   for retry := 0; retry < 10; retry++ {
    time.Sleep(1e8)

Index: store/store_test.go
=== modified file 'store/store_test.go'
--- store/store_test.go 2014-03-27 05:00:05 +0000
+++ store/store_test.go 2014-04-01 00:11:10 +0000
@@ -4,6 +4,7 @@
  package store_test

  import (
+ "flag"
   "fmt"
   "io"
   "io/ioutil"
@@ -35,6 +36,8 @@
   store *store.Store
  }

+var mongojs *bool = flag.Bool("mongojs", false, "MongoDB in test
environment supports javascript")
+
  type TrivialSuite struct{}

  func (s *StoreSuite) SetUpSuite(c *gc.C) {
@@ -601,6 +604,10 @@
  }

  func (s *StoreSuite) TestSumCounters(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
   req := store.CounterRequest{Key: []string{"a"}}
   cs, err := s.store.Counters(&req)
   c.Assert(err, gc.IsNil)
@@ -674,6 +681,10 @@
  }

  func (s *StoreSuite) TestCountersReadOnlySum(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
   // Summing up an unknown key shouldn't add the key to the database.
   req := store.CounterRequest{Key: []string{"a", "b", "c"}}
   _, err := s.store.Counters(&req)
@@ -686,6 +697,10 @@
  }

  func (s *StoreSuite) TestCountersTokenCaching(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
   assertSum := func(i int, want int64) {
    req := store.CounterRequest{Key: []string{strconv.Itoa(i)}}
    cs, err := s.store.Counters(&req)
@@ -741,6 +756,10 @@
  }

  func (s *StoreSuite) TestCounterTokenUniqueness(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
   var wg0, wg1 sync.WaitGroup
   wg0.Add(10)
   wg1.Add(10)
@@ -762,6 +781,...

Read more...

Revision history for this message
Casey Marshall (cmars) wrote :
Revision history for this message
Dave Cheney (dave-cheney) wrote :

lgtm, you can use `lbox propose -bug=1295140` to link this branch to the bug

Revision history for this message
William Reade (fwereade) wrote :

https://codereview.appspot.com/82930043/diff/1/store/store_test.go
File store/store_test.go (right):

https://codereview.appspot.com/82930043/diff/1/store/store_test.go#newcode39
store/store_test.go:39: var mongojs *bool = flag.Bool("mongojs", false,
"MongoDB in test environment supports javascript")
LGTM *so long as* we have a path for running CI tests with mongojs
somewhere. Please coordinate with curtis.

https://codereview.appspot.com/82930043/

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (41.7 KiB)

The attempt to merge lp:~cmars/juju-core/cs-mongo-tests into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.014s
ok launchpad.net/juju-core/agent 1.113s
ok launchpad.net/juju-core/agent/mongo 0.275s
ok launchpad.net/juju-core/agent/tools 0.217s
ok launchpad.net/juju-core/bzr 4.963s
ok launchpad.net/juju-core/cert 2.709s
ok launchpad.net/juju-core/charm 0.494s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.030s
ok launchpad.net/juju-core/cloudinit/sshinit 0.747s
ok launchpad.net/juju-core/cmd 0.154s
ok launchpad.net/juju-core/cmd/charm-admin 0.746s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/envcmd 0.198s
ok launchpad.net/juju-core/cmd/juju 210.542s

----------------------------------------------------------------------
PANIC: agent.go:0: MachineSuite.SetUpTest

[LOG] 11.67958 DEBUG juju.environs.configstore Making /tmp/jctest.8Pq/gocheck-8674665223082153551/73/home/ubuntu/.juju/environments
[LOG] 11.74973 INFO juju environs/testing: uploading FAKE tools 1.19.0-precise-amd64
[LOG] 11.75033 INFO juju environs/testing: uploading FAKE tools 1.19.0-precise-amd64
[LOG] 11.76160 INFO juju environs/testing: uploading FAKE tools 1.19.0-precise-amd64
[LOG] 11.76231 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 11.76232 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 11.76239 DEBUG juju.environs.simplestreams fetchData failed for "tools/streams/v1/index.sjson": file "tools/streams/v1/index.sjson" not found not found
[LOG] 11.76242 DEBUG juju.environs.simplestreams cannot load index "streams/v1/index.sjson": invalid URL "tools/streams/v1/index.sjson" not found
[LOG] 11.76244 DEBUG juju.environs.simplestreams fetchData failed for "tools/streams/v1/index.json": file "tools/streams/v1/index.json" not found not found
[LOG] 11.76250 DEBUG juju.environs.simplestreams cannot load index "streams/v1/index.json": invalid URL "tools/streams/v1/index.json" not found
[LOG] 11.76286 INFO juju.environs.tools Writing tools/streams/v1/index.json
[LOG] 11.76291 INFO juju.environs.tools Writing tools/streams/v1/com.ubuntu.juju:released:tools.json
[LOG] 11.76304 DEBUG juju.environs.bootstrap environment "dummyenv" supports service/machine networks: true
[LOG] 11.76305 INFO juju.environs.bootstrap bootstrapping environment "dummyenv"
[LOG] 11.76308 DEBUG juju.environs.bootstrap looking for bootstrap tools: series="precise", arch=<nil>, version=1.19.0
[LOG] 11.76309 INFO juju.environs.tools reading tools with major.minor version 1.19
[LOG] 11.76314 INFO juju.environs.tools filtering tools by version: 1.19.0
[LOG] 11.76315 INFO juju.environs.tools filtering tools by series: precise
[LOG] 11.76316 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 11.76322 DEBUG juju.environs.simplestreams fetchData failed for "tools/streams/v1/index.sjson": file "tools/streams/v1/index.s...

Revision history for this message
John A Meinel (jameinel) wrote :

Note that we can't easily pass flags on the bot, but the *bot* is perfectly happy to run these tests, because it is running precise with the full mongodb version.

Revision history for this message
John A Meinel (jameinel) wrote :

We could probably change the Tarmac landing bot to do:

go test ./... && (cd store && go test -mongojs=true) && ...

Would that work for you?

Revision history for this message
Casey Marshall (cmars) wrote :
Revision history for this message
Casey Marshall (cmars) wrote :

Updated per jam's suggestions:
- invert the logic, mongojs tests are on by default unless you opt-out
- support env var JUJU_NOTEST_MONGODB=1 to disable mongojs tests

https://codereview.appspot.com/82930043/

Revision history for this message
Casey Marshall (cmars) wrote :

On 2014/04/10 16:23:57, cmars wrote:
> Updated per jam's suggestions:
> - invert the logic, mongojs tests are on by default unless you opt-out
> - support env var JUJU_NOTEST_MONGODB=1 to disable mongojs tests

Correction: it's JUJU_NOTEST_MONGOJS=1

https://codereview.appspot.com/82930043/

Revision history for this message
John A Meinel (jameinel) wrote :

LGTM.

I slightly prefer the positive form:
JUJU_TEST_MONGOJS=disable
or something like that, but I still think this is better than not having
it.

https://codereview.appspot.com/82930043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CONTRIBUTING'
2--- CONTRIBUTING 2014-03-07 12:02:41 +0000
3+++ CONTRIBUTING 2014-04-10 18:06:27 +0000
4@@ -132,6 +132,19 @@
5
6 go test launchpad.net/juju-core
7
8+MongoDB
9+-------
10+
11+Many tests use a standalone instance of mongod as part of their setup. The
12+`mongod` binary found in $PATH is executed by these suites.
13+
14+Some tests (particularly those under ./store/...) assume a MongoDB instance
15+that supports Javascript for map-reduce functions. These functions are not
16+supported by juju-mongodb and the associated tests will fail unless disabled
17+with an environment variable:
18+
19+ JUJU_NOTEST_MONGOJS=1 go test launchpad.net/juju-core/...
20+
21 Proposing
22 =========
23
24
25=== modified file 'store/server_test.go'
26--- store/server_test.go 2014-03-27 05:00:05 +0000
27+++ store/server_test.go 2014-04-10 18:06:27 +0000
28@@ -203,6 +203,10 @@
29 // checkCounterSum checks that statistics are properly collected.
30 // It retries a few times as they are generally collected in background.
31 func (s *StoreSuite) checkCounterSum(c *gc.C, key []string, prefix bool, expected int64) {
32+ if *noTestMongoJs {
33+ c.Skip("MongoDB javascript not available")
34+ }
35+
36 var sum int64
37 for retry := 0; retry < 10; retry++ {
38 time.Sleep(1e8)
39@@ -298,6 +302,10 @@
40 }
41
42 func (s *StoreSuite) TestStatsCounter(c *gc.C) {
43+ if *noTestMongoJs {
44+ c.Skip("MongoDB javascript not available")
45+ }
46+
47 for _, key := range [][]string{{"a", "b"}, {"a", "b"}, {"a", "c"}, {"a"}} {
48 err := s.store.IncCounter(key)
49 c.Assert(err, gc.IsNil)
50@@ -328,6 +336,10 @@
51 }
52
53 func (s *StoreSuite) TestStatsCounterList(c *gc.C) {
54+ if *noTestMongoJs {
55+ c.Skip("MongoDB javascript not available")
56+ }
57+
58 incs := [][]string{
59 {"a"},
60 {"a", "b"},
61@@ -376,6 +388,10 @@
62 }
63
64 func (s *StoreSuite) TestStatsCounterBy(c *gc.C) {
65+ if *noTestMongoJs {
66+ c.Skip("MongoDB javascript not available")
67+ }
68+
69 incs := []struct {
70 key []string
71 day int
72
73=== modified file 'store/store_test.go'
74--- store/store_test.go 2014-03-27 05:00:05 +0000
75+++ store/store_test.go 2014-04-10 18:06:27 +0000
76@@ -4,9 +4,11 @@
77 package store_test
78
79 import (
80+ "flag"
81 "fmt"
82 "io"
83 "io/ioutil"
84+ "os"
85 "strconv"
86 "sync"
87 stdtesting "testing"
88@@ -35,12 +37,19 @@
89 store *store.Store
90 }
91
92+var noTestMongoJs *bool = flag.Bool("notest-mongojs", false, "Disable MongoDB tests that require javascript")
93+
94 type TrivialSuite struct{}
95
96 func (s *StoreSuite) SetUpSuite(c *gc.C) {
97 s.MgoSuite.SetUpSuite(c)
98 s.HTTPSuite.SetUpSuite(c)
99 s.LoggingSuite.SetUpSuite(c)
100+
101+ if os.Getenv("JUJU_NOTEST_MONGOJS") == "1" {
102+ c.Log("Tests requiring MongoDB Javascript will be skipped")
103+ *noTestMongoJs = true
104+ }
105 }
106
107 func (s *StoreSuite) TearDownSuite(c *gc.C) {
108@@ -601,6 +610,10 @@
109 }
110
111 func (s *StoreSuite) TestSumCounters(c *gc.C) {
112+ if *noTestMongoJs {
113+ c.Skip("MongoDB javascript not available")
114+ }
115+
116 req := store.CounterRequest{Key: []string{"a"}}
117 cs, err := s.store.Counters(&req)
118 c.Assert(err, gc.IsNil)
119@@ -674,6 +687,10 @@
120 }
121
122 func (s *StoreSuite) TestCountersReadOnlySum(c *gc.C) {
123+ if *noTestMongoJs {
124+ c.Skip("MongoDB javascript not available")
125+ }
126+
127 // Summing up an unknown key shouldn't add the key to the database.
128 req := store.CounterRequest{Key: []string{"a", "b", "c"}}
129 _, err := s.store.Counters(&req)
130@@ -686,6 +703,10 @@
131 }
132
133 func (s *StoreSuite) TestCountersTokenCaching(c *gc.C) {
134+ if *noTestMongoJs {
135+ c.Skip("MongoDB javascript not available")
136+ }
137+
138 assertSum := func(i int, want int64) {
139 req := store.CounterRequest{Key: []string{strconv.Itoa(i)}}
140 cs, err := s.store.Counters(&req)
141@@ -741,6 +762,10 @@
142 }
143
144 func (s *StoreSuite) TestCounterTokenUniqueness(c *gc.C) {
145+ if *noTestMongoJs {
146+ c.Skip("MongoDB javascript not available")
147+ }
148+
149 var wg0, wg1 sync.WaitGroup
150 wg0.Add(10)
151 wg1.Add(10)
152@@ -762,6 +787,10 @@
153 }
154
155 func (s *StoreSuite) TestListCounters(c *gc.C) {
156+ if *noTestMongoJs {
157+ c.Skip("MongoDB javascript not available")
158+ }
159+
160 incs := [][]string{
161 {"c", "b", "a"}, // Assign internal id c < id b < id a, to make sorting slightly trickier.
162 {"a"},
163@@ -823,6 +852,10 @@
164 }
165
166 func (s *StoreSuite) TestListCountersBy(c *gc.C) {
167+ if *noTestMongoJs {
168+ c.Skip("MongoDB javascript not available")
169+ }
170+
171 incs := []struct {
172 key []string
173 day int

Subscribers

People subscribed via source and target branches

to status/vote changes: