[VOL-2108] Updated with fix for concurrent access of map in deviceHandler
Updated with review comments
Updated with sync.map
Updated with review comments
Change-Id: Iabe2557cf8e5e4a7863d86467a13bc49e24c628d
diff --git a/adaptercore/openolt_eventmgr_test.go b/adaptercore/openolt_eventmgr_test.go
index 8012318..4bd7a65 100644
--- a/adaptercore/openolt_eventmgr_test.go
+++ b/adaptercore/openolt_eventmgr_test.go
@@ -18,6 +18,7 @@
package adaptercore
import (
+ "sync"
"testing"
"time"
@@ -28,11 +29,11 @@
func mockEventMgr() *OpenOltEventMgr {
ep := &mocks.MockEventProxy{}
dh := &DeviceHandler{}
- dh.onus = make(map[string]*OnuDevice)
- dh.onus[dh.formOnuKey(1, 1)] = &OnuDevice{deviceID: "TEST_ONU",
+ dh.onus = sync.Map{}
+ dh.onus.Store(dh.formOnuKey(1, 1), &OnuDevice{deviceID: "TEST_ONU",
deviceType: "ONU",
serialNumber: "TEST_ONU_123",
- onuID: 1, intfID: 1}
+ onuID: 1, intfID: 1})
return NewEventMgr(ep, dh)
}
func TestOpenOltEventMgr_ProcessEvents(t *testing.T) {