VOL-2867 - Removed unnescessary proto.Clone() in getDevice() and getLogicalDevice().
Also renamed getDevice() to getDeviceReadOnly(), getLogicalDevice() to getLogicalDeviceReadOnly(), and getDeviceReadOnly() to getDeviceReadOnlyWithoutLock().
Callers of *ReadOnly() functions must not modify the returned structures.
Also fixed places where lock was not acquired before calling getDevice().
Related to VOL-3356.
Change-Id: I9913a76a497c4d977457edaea3b199a24a3a5cb8
diff --git a/rw_core/core/device/agent_test.go b/rw_core/core/device/agent_test.go
index 9249198..c8928e2 100755
--- a/rw_core/core/device/agent_test.go
+++ b/rw_core/core/device/agent_test.go
@@ -179,7 +179,7 @@
}
func (dat *DATest) updateDeviceConcurrently(t *testing.T, da *Agent, globalWG *sync.WaitGroup) {
- originalDevice, err := da.getDevice(context.Background())
+ originalDevice, err := da.getDeviceReadOnly(context.Background())
originalDevicePorts := da.listDevicePorts()
assert.Nil(t, err)
assert.NotNil(t, originalDevice)
@@ -242,7 +242,7 @@
expectedChange.Vlan = vlan
expectedChange.Reason = reason
- updatedDevice, _ := da.getDevice(context.Background())
+ updatedDevice, _ := da.getDeviceReadOnly(context.Background())
updatedDevicePorts := da.listDevicePorts()
assert.NotNil(t, updatedDevice)
fmt.Printf("1 %+v\n", expectedChange)