Feature #4208
closed
Add more replication pool tests for Hadoop / Ceph bindings
Added by Anonymous about 11 years ago.
Updated about 5 years ago.
Description
We should add a test (or several) for the scenario where the user specifies a level of replication that does not exactly match an existing pool. This would require the logic that "rounds up" to kick in (which is what we want to test).
Something like this added to the current custom test should do the trick?
diff --git a/src/test/org/apache/hadoop/fs/ceph/TestCephCustomReplication.java b/src/test/org/apache/hadoop/fs/ceph/TestCephCustomReplication.java
index 19e1a3d..a6e1286 100644
--- a/src/test/org/apache/hadoop/fs/ceph/TestCephCustomReplication.java
+++ b/src/test/org/apache/hadoop/fs/ceph/TestCephCustomReplication.java
@@ -14,12 +14,12 @@ public class TestCephCustomReplication extends CephTestBase {
String pools[] = getConfiguredDataPools();
assertTrue(pools.length > 0);
- int i = 0;
+ int max_repl = 0;
for (String pool : pools) {
int repl = getPoolReplication(pool);
+ max_repl = max(max_repl, max_repl)
Path path = new Path("/file.custom.repl." + pool + "." + repl);
- System.out.println("path " + path + " pool " + pool + " repl " + repl);
FSDataOutputStream out = fs.create(path, false, 4096,
(short)repl, fs.getDefaultBlockSize());
@@ -31,5 +31,18 @@ public class TestCephCustomReplication extends CephTestBase {
fs.delete(path);
}
+
+ assert max_repl < Short.MAX_VALUE;
+
+ Path path = new Path("/file.custom.repl." + Short.MAX_VALUE);
+ FSDataOutputStream out = fs.create(path, false, 4096,
+ Short.MAX_VALUE, fs.getDefaultBlockSize());
+ out.write(data, 0, data.length);
+ out.close();
+
+ FileStatus status = fs.getFileStatus(path);
+ assertTrue(status.getReplication() == max_repl);
+
+ fs.delete(path);
}
}
- Project changed from Ceph to CephFS
- Category changed from 20 to 48
Bulk move of hadoop category into FS project.
- Status changed from New to Rejected
Java/Hadoop testing is no longer a priority.
- Category deleted (
48)
- Labels (FS) Java/Hadoop added
Also available in: Atom
PDF