@AfterClass public static void cleanUp() { node1.flushDB(); node2.flushDB(); node3.flushDB(); node4.flushDB(); node1.clusterReset(Reset.SOFT); node2.clusterReset(Reset.SOFT); node3.clusterReset(Reset.SOFT); node4.clusterReset(Reset.SOFT); }
@Test public void testReadonly() throws Exception { node1.clusterMeet(localHost, nodeInfoSlave2.getPort()); JedisClusterTestUtil.waitForClusterReady(node1, node2, node3, nodeSlave2); for (String nodeInfo : node2.clusterNodes().split("\n")) { if (nodeInfo.contains("myself")) { nodeSlave2.clusterReplicate(nodeInfo.split(" ")[0]); break; } } try { nodeSlave2.get("test"); fail(); } catch (JedisMovedDataException e) { } nodeSlave2.readonly(); nodeSlave2.get("test"); nodeSlave2.clusterReset(Reset.SOFT); nodeSlave2.flushDB(); }