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.
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)
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,10 @@
}
func (s *StoreSuite) TestListCounters(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
incs := [][]string{
{"c", "b", "a"}, // Assign internal id c < id b < id a, to make sorting
slightly trickier.
{"a"},
@@ -823,6 +846,10 @@
}
func (s *StoreSuite) TestListCountersBy(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
incs := []struct {
key []string
day int
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): test.go
A [revision details]
M store/server_
M store/store_test.go
Index: [revision details] 20140331232430- drvjtzkduheba0p m
=== 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-
+New revision: <email address hidden>
Index: store/server_ test.go server_ test.go' test.go 2014-03-27 05:00:05 +0000 test.go 2014-04-01 00:11:10 +0000
=== modified file 'store/
--- store/server_
+++ store/server_
@@ -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 store_test. go'
=== modified file 'store/
--- 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) { quest{Key: []string{"a"}} Counters( &req)
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
req := store.CounterRe
cs, err := s.store.
c.Assert(err, gc.IsNil)
@@ -674,6 +681,10 @@
}
func (s *StoreSuite) TestCountersRea dOnlySum( c *gc.C) { quest{Key: []string{"a", "b", "c"}} Counters( &req)
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
// Summing up an unknown key shouldn't add the key to the database.
req := store.CounterRe
_, err := s.store.
@@ -686,6 +697,10 @@
}
func (s *StoreSuite) TestCountersTok enCaching( c *gc.C) { quest{Key: []string{ strconv. Itoa(i) }} Counters( &req)
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
assertSum := func(i int, want int64) {
req := store.CounterRe
cs, err := s.store.
@@ -741,6 +756,10 @@
}
func (s *StoreSuite) TestCounterToke nUniqueness( 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,10 @@
}
func (s *StoreSuite) TestListCounters(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
incs := [][]string{
{"c", "b", "a"}, // Assign internal id c < id b < id a, to make sorting
slightly trickier.
{"a"},
@@ -823,6 +846,10 @@
}
func (s *StoreSuite) TestListCounter sBy(c *gc.C) {
+ if !*mongojs {
+ c.Skip("MongoDB javascript not available")
+ }
+
incs := []struct {
key []string
day int