|
@@ -85,10 +85,12 @@ public class TestSnapshotCommands {
|
|
@Test
|
|
@Test
|
|
public void testAllowSnapshot() throws Exception {
|
|
public void testAllowSnapshot() throws Exception {
|
|
// Idempotent test
|
|
// Idempotent test
|
|
- DFSTestUtil.DFSAdminRun("-allowSnapshot /sub1", 0, "Allowing snaphot on /sub1 succeeded", conf);
|
|
|
|
- // allow normal dir success
|
|
|
|
|
|
+ DFSTestUtil.DFSAdminRun("-allowSnapshot /sub1", 0,
|
|
|
|
+ "Allowing snapshot " + "on /sub1 succeeded", conf);
|
|
|
|
+ // allow normal dir success
|
|
DFSTestUtil.FsShellRun("-mkdir /sub2", conf);
|
|
DFSTestUtil.FsShellRun("-mkdir /sub2", conf);
|
|
- DFSTestUtil.DFSAdminRun("-allowSnapshot /sub2", 0, "Allowing snaphot on /sub2 succeeded", conf);
|
|
|
|
|
|
+ DFSTestUtil.DFSAdminRun("-allowSnapshot /sub2", 0,
|
|
|
|
+ "Allowing snapshot " + "on /sub2 succeeded", conf);
|
|
// allow non-exists dir failed
|
|
// allow non-exists dir failed
|
|
DFSTestUtil.DFSAdminRun("-allowSnapshot /sub3", -1, null, conf);
|
|
DFSTestUtil.DFSAdminRun("-allowSnapshot /sub3", -1, null, conf);
|
|
}
|
|
}
|
|
@@ -159,9 +161,11 @@ public class TestSnapshotCommands {
|
|
DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", -1,
|
|
DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", -1,
|
|
"disallowSnapshot: The directory /sub1 has snapshot(s). Please redo the operation after removing all the snapshots.", conf);
|
|
"disallowSnapshot: The directory /sub1 has snapshot(s). Please redo the operation after removing all the snapshots.", conf);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot /sub1 sn1", conf);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot /sub1 sn1", conf);
|
|
- DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", 0, "Disallowing snaphot on /sub1 succeeded", conf);
|
|
|
|
|
|
+ DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", 0,
|
|
|
|
+ "Disallowing snapshot on /sub1 succeeded", conf);
|
|
// Idempotent test
|
|
// Idempotent test
|
|
- DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", 0, "Disallowing snaphot on /sub1 succeeded", conf);
|
|
|
|
|
|
+ DFSTestUtil.DFSAdminRun("-disallowSnapshot /sub1", 0,
|
|
|
|
+ "Disallowing snapshot on /sub1 succeeded", conf);
|
|
// now it can be deleted
|
|
// now it can be deleted
|
|
DFSTestUtil.FsShellRun("-rmr /sub1", conf);
|
|
DFSTestUtil.FsShellRun("-rmr /sub1", conf);
|
|
}
|
|
}
|
|
@@ -173,7 +177,7 @@ public class TestSnapshotCommands {
|
|
config.set("fs.defaultFS", "hdfs://127.0.0.1:1024");
|
|
config.set("fs.defaultFS", "hdfs://127.0.0.1:1024");
|
|
String path = fs.getUri() + "/Fully/QPath";
|
|
String path = fs.getUri() + "/Fully/QPath";
|
|
DFSTestUtil.DFSAdminRun("-allowSnapshot " + path, 0,
|
|
DFSTestUtil.DFSAdminRun("-allowSnapshot " + path, 0,
|
|
- "Allowing snaphot on " + path + " succeeded", config);
|
|
|
|
|
|
+ "Allowing snapshot on " + path + " succeeded", config);
|
|
DFSTestUtil.FsShellRun("-createSnapshot " + path + " sn1", config);
|
|
DFSTestUtil.FsShellRun("-createSnapshot " + path + " sn1", config);
|
|
// create file1
|
|
// create file1
|
|
DFSTestUtil
|
|
DFSTestUtil
|
|
@@ -193,7 +197,7 @@ public class TestSnapshotCommands {
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + path + " sn1", config);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + path + " sn1", config);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + path + " sn3", config);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + path + " sn3", config);
|
|
DFSTestUtil.DFSAdminRun("-disallowSnapshot " + path, 0,
|
|
DFSTestUtil.DFSAdminRun("-disallowSnapshot " + path, 0,
|
|
- "Disallowing snaphot on " + path + " succeeded", config);
|
|
|
|
|
|
+ "Disallowing snapshot on " + path + " succeeded", config);
|
|
fs.delete(new Path("/Fully/QPath"), true);
|
|
fs.delete(new Path("/Fully/QPath"), true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -205,7 +209,7 @@ public class TestSnapshotCommands {
|
|
fs.mkdirs(snapDirPath);
|
|
fs.mkdirs(snapDirPath);
|
|
|
|
|
|
DFSTestUtil.DFSAdminRun("-allowSnapshot " + snapDirPath, 0,
|
|
DFSTestUtil.DFSAdminRun("-allowSnapshot " + snapDirPath, 0,
|
|
- "Allowing snaphot on " + snapDirPath + " succeeded", config);
|
|
|
|
|
|
+ "Allowing snapshot on " + snapDirPath + " succeeded", config);
|
|
DFSTestUtil.createFile(fs, new Path(snapDirPath, "file1"),
|
|
DFSTestUtil.createFile(fs, new Path(snapDirPath, "file1"),
|
|
1024, (short) 1, 100);
|
|
1024, (short) 1, 100);
|
|
DFSTestUtil.FsShellRun("-createSnapshot " + snapDirPath + " sn1", config);
|
|
DFSTestUtil.FsShellRun("-createSnapshot " + snapDirPath + " sn1", config);
|
|
@@ -242,7 +246,7 @@ public class TestSnapshotCommands {
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + snapDir + " sn3", config);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + snapDir + " sn3", config);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + snapDir + " sn4", config);
|
|
DFSTestUtil.FsShellRun("-deleteSnapshot " + snapDir + " sn4", config);
|
|
DFSTestUtil.DFSAdminRun("-disallowSnapshot " + snapDir, 0,
|
|
DFSTestUtil.DFSAdminRun("-disallowSnapshot " + snapDir, 0,
|
|
- "Disallowing snaphot on " + snapDirPath + " succeeded", config);
|
|
|
|
|
|
+ "Disallowing snapshot on " + snapDirPath + " succeeded", config);
|
|
fs.delete(new Path("/Fully/QPath"), true);
|
|
fs.delete(new Path("/Fully/QPath"), true);
|
|
}
|
|
}
|
|
}
|
|
}
|