public virtual void TestAllowSnapshot() { // Idempotent test DFSTestUtil.DFSAdminRun("-allowSnapshot /sub1", 0, "Allowing snaphot on /sub1 succeeded" , conf); // allow normal dir success DFSTestUtil.FsShellRun("-mkdir /sub2", conf); DFSTestUtil.DFSAdminRun("-allowSnapshot /sub2", 0, "Allowing snaphot on /sub2 succeeded" , conf); // allow non-exists dir failed DFSTestUtil.DFSAdminRun("-allowSnapshot /sub3", -1, null, conf); }
public virtual void TestDisallowSnapshot() { DFSTestUtil.FsShellRun("-createSnapshot /sub1 sn1", conf); // cannot delete snapshotable dir DFSTestUtil.FsShellRun("-rmr /sub1", 1, "The directory /sub1 cannot be deleted since /sub1 is snapshottable and already has snapshots" , conf); DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", -1, "disallowSnapshot: The directory /sub1 has snapshot(s). Please redo the operation after removing all the snapshots." , conf); DFSTestUtil.FsShellRun("-deleteSnapshot /sub1 sn1", conf); DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", 0, "Disallowing snaphot on /sub1 succeeded" , conf); // Idempotent test DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", 0, "Disallowing snaphot on /sub1 succeeded" , conf); // now it can be deleted DFSTestUtil.FsShellRun("-rmr /sub1", conf); }