Skip to content

Commit

Permalink
Fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
zbud-msft committed Jul 27, 2023
1 parent 46bf47d commit d2168e1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gnmi_server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3295,7 +3295,7 @@ func TestTableKeyOnDeletion(t *testing.T) {
}

var mutexNoti sync.Mutex

var mutexPaths sync.Mutex
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
q := tt.q
Expand Down Expand Up @@ -3323,16 +3323,19 @@ func TestTableKeyOnDeletion(t *testing.T) {

time.Sleep(time.Millisecond * 1500)


mutexNoti.Lock()
defer mutexNoti.Unlock()
if diff := pretty.Compare(tt.wantNoti, gotNoti); diff != "" {
t.Log("\n Want: \n", tt.wantNoti)
t.Log("\n Got : \n", gotNoti)
t.Errorf("unexpected updates:\n%s", diff)
}

mutexPaths.Lock()
defer mutexPaths.Unlock()
for _, path := range tt.paths {
rclient.HSet(path, "state", "Established")
rclient.Hset(path, "peerType", "e-BGP")
}
})
}
Expand Down

0 comments on commit d2168e1

Please sign in to comment.