Developing lightweight computation at the DSG edge

Commit 55b86d68 authored by Mathias Weber's avatar Mathias Weber
Browse files

fixed tests

parent 7683bbe1
...@@ -21,7 +21,7 @@ func TestSimple(t *testing.T) { ...@@ -21,7 +21,7 @@ func TestSimple(t *testing.T) {
} }
bucket := Bucket{[]byte("bucket")} bucket := Bucket{[]byte("bucket")}
key := Key("keyCounter") key := Key("keyCounter")
_, err = bucket.Update(tx, CounterInc(key, 1)) err = bucket.Update(tx, CounterInc(key, 1))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -33,7 +33,7 @@ func TestSimple(t *testing.T) { ...@@ -33,7 +33,7 @@ func TestSimple(t *testing.T) {
fmt.Print(counterVal) fmt.Print(counterVal)
_, err = tx.Commit() err = tx.Commit()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -55,7 +55,7 @@ func TestSetUpdate(t *testing.T) { ...@@ -55,7 +55,7 @@ func TestSetUpdate(t *testing.T) {
bucket := Bucket{[]byte("bucket")} bucket := Bucket{[]byte("bucket")}
key := Key("keySet") key := Key("keySet")
_, err = bucket.Update(tx, SetAdd(key, []byte("test1"))) err = bucket.Update(tx, SetAdd(key, []byte("test1")))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -70,7 +70,7 @@ func TestSetUpdate(t *testing.T) { ...@@ -70,7 +70,7 @@ func TestSetUpdate(t *testing.T) {
fmt.Println(string(v)) fmt.Println(string(v))
} }
_, err = tx.Commit() err = tx.Commit()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -97,20 +97,14 @@ func TestManyUpdates(t *testing.T) { ...@@ -97,20 +97,14 @@ func TestManyUpdates(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
updateResp, err := bucket.Update(tx, CounterInc(key, 1)) err = bucket.Update(tx, CounterInc(key, 1))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !(*updateResp.Success) { err = tx.Commit()
fmt.Printf("Update #%d not successful\n", i)
}
commitResp, err := tx.Commit()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if !(*commitResp.Success) {
fmt.Printf("Commit #%d not successful\n", i)
}
if i%1000 == 0 { if i%1000 == 0 {
fmt.Println(i) fmt.Println(i)
} }
...@@ -156,7 +150,7 @@ func TestStatic(t *testing.T) { ...@@ -156,7 +150,7 @@ func TestStatic(t *testing.T) {
tx := client.CreateStaticTransaction() tx := client.CreateStaticTransaction()
_, err = bucket.Update(tx, CounterInc(key, 1)) err = bucket.Update(tx, CounterInc(key, 1))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment