File tree 2 files changed +28
-1
lines changed
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 38
38
cloc --exclude-dir=vendor,3rdmocks,mocks --not-match-f=test .
39
39
40
40
unit-test :
41
- go test --race -cover ./utils/... ./types/... ./store/etcdv3/... ./scheduler/complex/... ./source/common/... ./network/sdn/...
41
+ go test --race -cover ./utils/... ./types/... ./store/etcdv3/... ./scheduler/complex/... ./source/common/... ./network/sdn/... ./lock/etcdlock/...
Original file line number Diff line number Diff line change
1
+ package etcdlock
2
+
3
+ import (
4
+ "context"
5
+ "testing"
6
+
7
+ "github.com/stretchr/testify/assert"
8
+
9
+ "github.com/coreos/etcd/integration"
10
+ )
11
+
12
+ func TestLock (t * testing.T ) {
13
+ cluster := integration .NewClusterV3 (t , & integration.ClusterConfig {Size : 1 })
14
+ defer cluster .Terminate (t )
15
+ cli := cluster .RandClient ()
16
+
17
+ _ , err := New (cli , "" , 1 )
18
+ assert .Error (t , err )
19
+ mutex , err := New (cli , "test" , 1 )
20
+ assert .NoError (t , err )
21
+
22
+ ctx := context .Background ()
23
+ err = mutex .Lock (ctx )
24
+ assert .NoError (t , err )
25
+ err = mutex .Unlock (ctx )
26
+ assert .NoError (t , err )
27
+ }
You can’t perform that action at this time.
0 commit comments