From 635db827651bf35c4fa20c6037c61b50ee981e73 Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Wed, 19 Feb 2014 15:14:00 -0600 Subject: [PATCH] ignore cass test if cass not running --- index/storage_test.go | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/index/storage_test.go b/index/storage_test.go index eb3e00631..e95c162f5 100644 --- a/index/storage_test.go +++ b/index/storage_test.go @@ -1,7 +1,10 @@ package index import ( + "fmt" + "net" "testing" + "time" // "io/ioutil" // "time" @@ -25,19 +28,25 @@ func TestStorage(t *testing.T) { So(BitCount(bm), ShouldEqual, 3) }) - Convey("cassandra", t, func() { - storage := NewCassStorage("127.0.0.1", "hotbox") + c, err := net.DialTimeout("tcp", "127.0.0.1:9042", 100*time.Millisecond) + if err != nil { + fmt.Println("NO cassandra skipping test") + } else { + c.Close() + Convey("cassandra", t, func() { + storage := NewCassStorage("127.0.0.1", "hotbox") - bm := storage.Fetch(bitmap_id, db, slice) - SetBit(bm, 0) - SetBit(bm, 1) - SetBit(bm, 2) - storage.Store(int64(bitmap_id), db, slice, bm.(*Bitmap)) - bm2 := storage.Fetch(bitmap_id, db, slice) - So(BitCount(bm), ShouldEqual, BitCount(bm2)) - So(BitCount(bm), ShouldEqual, bm.Count()) - So(BitCount(bm), ShouldEqual, 3) + bm := storage.Fetch(bitmap_id, db, slice) + SetBit(bm, 0) + SetBit(bm, 1) + SetBit(bm, 2) + storage.Store(int64(bitmap_id), db, slice, bm.(*Bitmap)) + bm2 := storage.Fetch(bitmap_id, db, slice) + So(BitCount(bm), ShouldEqual, BitCount(bm2)) + So(BitCount(bm), ShouldEqual, bm.Count()) + So(BitCount(bm), ShouldEqual, 3) - }) + }) + } }