Fix test
This commit is contained in:
parent
f761d3eefe
commit
96e5302ceb
|
@ -188,6 +188,9 @@ func TestForUpdate(t *testing.T) {
|
||||||
|
|
||||||
// lock is NOT used
|
// lock is NOT used
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
|
wg2 := &sync.WaitGroup{}
|
||||||
|
wg2.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
f3 := new(ForUpdate)
|
f3 := new(ForUpdate)
|
||||||
session3.Where("id = ?", 1)
|
session3.Where("id = ?", 1)
|
||||||
|
@ -201,10 +204,10 @@ func TestForUpdate(t *testing.T) {
|
||||||
t.Errorf("read lock failed")
|
t.Errorf("read lock failed")
|
||||||
}
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
|
wg2.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// wait for go rountines
|
wg2.Wait()
|
||||||
time.Sleep(50 * time.Millisecond)
|
|
||||||
|
|
||||||
f := new(ForUpdate)
|
f := new(ForUpdate)
|
||||||
f.Name = "updated by session1"
|
f.Name = "updated by session1"
|
||||||
|
|
Loading…
Reference in New Issue