Developing lightweight computation at the DSG edge
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LightKone
antidote-go-client
Commits
3dd25506
Commit
3dd25506
authored
Mar 20, 2018
by
Mathias Weber
Browse files
mass update test
parent
2a059878
Changes
1
Hide whitespace changes
Inline
Side-by-side
antidoteclient_test.go
View file @
3dd25506
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment