keith-turner commented on a change in pull request #1043: FLUO-1002 Create 
integration test for `FluoAdmin.remove()`
URL: https://github.com/apache/fluo/pull/1043#discussion_r196757745
 
 

 ##########
 File path: 
modules/integration/src/test/java/org/apache/fluo/integration/client/FluoAdminImplIT.java
 ##########
 @@ -184,4 +197,98 @@ public void testInitializeLongChroot() throws Exception {
     }
   }
 
+
+  @Test
+  public void testRemove() throws Exception {
+
+    // the oracle server is started before every test so it is running
+    // double check by making sure its leader
+
+    try (FluoAdmin admin = new FluoAdminImpl(config)) {
+      admin.remove();
+      fail("expected remove() to fail with oracle server running");
+    } catch (FluoException e) {
+    }
+
+    oserver.stop();
+
+    try (CuratorFramework curator = CuratorUtil.newAppCurator(config)) {
+      curator.start();
+      Assert.assertFalse(OracleServerUtils.oracleExists(curator));
+    }
+    // this should succeed now with the oracle server stopped
+    try (FluoAdmin admin = new FluoAdminImpl(config)) {
+      admin.remove();
+    }
+
+    // verify path is not in zookeeper after remove
+    try (CuratorFramework curator = CuratorUtil.newRootFluoCurator(config)) {
+      curator.start();
+      String appRootDir = ZookeeperUtil.parseRoot(config.getAppZookeepers());
+      assertFalse(CuratorUtil.pathExist(curator, appRootDir));
+    }
+
+    // should succeed without clearing anything
+    try (FluoAdmin admin = new FluoAdminImpl(config)) {
+      InitializationOptions opts =
+          new 
InitializationOptions().setClearTable(false).setClearZookeeper(false);
+      admin.initialize(opts);
+    }
+
+    oserver.start();
+
+    // write some data into the table and test remove again
 
 Review comment:
   It would be good to use the Fluo API to read and write data because if for 
some reason Fluo API calls fail after remove, we want to know.  Later in the 
test, I think it would still be good to use an Accumulo scanner to ensure the 
table is empty though.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to