Developing lightweight computation at the DSG edge

Commit 3dd25506 authored by Mathias Weber's avatar Mathias Weber
Browse files

mass update test

parent 2a059878
......@@ -4,6 +4,7 @@ package antidoteclient
import (
"testing"
"fmt"
"sync"
)
func TestSimple(t *testing.T) {
......@@ -41,6 +42,56 @@ func TestSimple(t *testing.T) {
}
func TestManyUpdates(t *testing.T) {
client, err := NewClient(Host{"127.0.0.1", 8087})
if err != nil {
t.Fatal(err)
}
crdtType := CRDTType_COUNTER
key := &ApbBoundObject{
Bucket: []byte("bucket"),
Key: []byte("keyMany"),
Type: &crdtType}
one := int64(1)
wg := sync.WaitGroup{}
wg.Add(10)
for k:=0; k<10; k++ {
go func() {
defer wg.Done()
for i := 0; i < 10000; i++ {
tx, err := client.StartTransaction()
if err != nil {
t.Fatal(err)
}
_, err = tx.Update(&ApbUpdateOp{
Boundobject: key,
Operation: &ApbUpdateOperation{Counterop: &ApbCounterUpdate{Inc: &one}},
})
if err != nil {
t.Fatal(err)
}
_, err = tx.Commit()
if err != nil {
t.Fatal(err)
}
if i%1000 == 0 {
fmt.Println(i)
}
}
}()
}
wg.Wait()
resp, err := client.StaticRead(key)
if err != nil {
t.Fatal(err)
}
fmt.Print(resp.Objects.Objects[0])
}
func TestStatic(t *testing.T) {
client, err := NewClient(Host{"127.0.0.1", 8087})
if err != nil {
......
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