ignore cass test if cass not running

This commit is contained in:
Todd Gruben 2014-02-19 15:14:00 -06:00
parent cceddf08b5
commit 635db82765

View file

@ -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)
})
})
}
}