Skip to content

Commit

Permalink
Add lock to to sdk-conformance compare() (googleforgames#1801)
Browse files Browse the repository at this point in the history
Likely isn't an issue, but figure it wouldn't hurt, and
probably should be there anyway.
  • Loading branch information
markmandel authored and ilkercelikyilmaz committed Oct 23, 2020
1 parent 1b7f586 commit cc7a9b9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/sdkserver/localsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,12 @@ func (l *LocalSDKServer) EqualSets(expected, received []string) bool {
// compare the results of a test run
func (l *LocalSDKServer) compare() {
if l.testMode {
l.testMutex.Lock()
defer l.testMutex.Unlock()
if !l.EqualSets(l.expectedSequence, l.requestSequence) {
l.logger.WithField("expected", l.expectedSequence).WithField("received", l.requestSequence).Info("Testing Failed")
// we don't care if the mutex gets unlocked on exit, so ignore the warning.
// nolint: gocritic
os.Exit(1)
} else {
l.logger.Info("Received requests match expected list. Test run was successful")
Expand Down

0 comments on commit cc7a9b9

Please sign in to comment.