Code review comment for lp:~cmars/juju-core/cs-mongo-tests

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

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,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

« Back to merge proposal