removeDevice on non-master node to silently ignore the request
instead of throwing IllegalState exception
Change-Id: Ida778ec112e80507fb05921e49297350d74dc519
diff --git a/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java b/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java
index 55fa1f4..975a7f8 100644
--- a/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java
+++ b/core/store/dist/src/test/java/org/onlab/onos/store/device/impl/GossipDeviceStoreTest.java
@@ -32,6 +32,7 @@
import org.onlab.onos.cluster.ControllerNode.State;
import org.onlab.onos.cluster.DefaultControllerNode;
import org.onlab.onos.cluster.NodeId;
+import org.onlab.onos.mastership.MastershipServiceAdapter;
import org.onlab.onos.mastership.MastershipTerm;
import org.onlab.onos.net.Annotations;
import org.onlab.onos.net.DefaultAnnotations;
@@ -143,6 +144,8 @@
ClusterService clusterService = new TestClusterService();
testGossipDeviceStore = new TestGossipDeviceStore(deviceClockService, clusterService, clusterCommunicator);
+ testGossipDeviceStore.mastershipService = new TestMastershipService();
+
gossipDeviceStore = testGossipDeviceStore;
gossipDeviceStore.activate();
deviceStore = gossipDeviceStore;
@@ -797,6 +800,13 @@
assertTrue("Remove event fired", removeLatch.await(1, TimeUnit.SECONDS));
}
+ private final class TestMastershipService extends MastershipServiceAdapter {
+ @Override
+ public NodeId getMasterFor(DeviceId deviceId) {
+ return NID1;
+ }
+ }
+
private static final class TestGossipDeviceStore extends GossipDeviceStore {
public TestGossipDeviceStore(