summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-02-08 21:36:13 -0800
committerJoe Buck <jbbuck@gmail.com>2013-02-09 18:58:21 -0800
commitabc80ffc5b1aab3915c049701ab85c57fe93d550 (patch)
treeb2be248532eaebbc687d49198e57f53bc7302476
parent6d199e22fbe390bc2d6c4e1cd0c3fa319dc7a577 (diff)
downloadceph-abc80ffc5b1aab3915c049701ab85c57fe93d550.tar.gz
java: make CephMountTest use user.* xattr names
Changes to the xattr code in Ceph require a few tweaks to existing test cases. Specifically, there is now a ceph.file.layout xattr by default and user defined xattrs are prepended with "user." Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Joe Buck <jbbuck@gmail.com> Reviewed-by: Noah Watkins <noahwatkins@gmail.com>
-rw-r--r--src/java/test/com/ceph/fs/CephMountTest.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/java/test/com/ceph/fs/CephMountTest.java b/src/java/test/com/ceph/fs/CephMountTest.java
index 9d205121cc5..7fbc94c7793 100644
--- a/src/java/test/com/ceph/fs/CephMountTest.java
+++ b/src/java/test/com/ceph/fs/CephMountTest.java
@@ -818,36 +818,41 @@ public class CephMountTest {
String val2 = "This is a different xattr";
byte[] buf1 = val1.getBytes();
byte[] buf2 = val2.getBytes();
- mount.setxattr(path, "attr1", buf1, buf1.length, mount.XATTR_CREATE);
- mount.setxattr(path, "attr2", buf2, buf2.length, mount.XATTR_CREATE);
+ mount.setxattr(path, "user.attr1", buf1, buf1.length, mount.XATTR_CREATE);
+ mount.setxattr(path, "user.attr2", buf2, buf2.length, mount.XATTR_CREATE);
/* list xattrs */
String[] xattrs = mount.listxattr(path);
- assertTrue(xattrs.length == 2);
+ /* the ceph.file.layout xattr exists for all files automatically */
+ assertTrue(xattrs.length == 3);
int found = 0;
for (String xattr : xattrs) {
- if (xattr.compareTo("attr1") == 0) {
+ if (xattr.compareTo("user.attr1") == 0) {
found++;
continue;
}
- if (xattr.compareTo("attr2") == 0) {
+ if (xattr.compareTo("user.attr2") == 0) {
+ found++;
+ continue;
+ }
+ if (xattr.compareTo("ceph.file.layout") == 0) {
found++;
continue;
}
System.out.println("found unwanted xattr: " + xattr);
}
- assertTrue(found == 2);
+ assertTrue(found == 3);
/* get first xattr by looking up length */
- long attr1_len = mount.getxattr(path, "attr1", null);
+ long attr1_len = mount.getxattr(path, "user.attr1", null);
byte[] out = new byte[(int)attr1_len];
- mount.getxattr(path, "attr1", out);
+ mount.getxattr(path, "user.attr1", out);
String outStr = new String(out);
assertTrue(outStr.compareTo(val1) == 0);
/* get second xattr assuming original length */
out = new byte[buf2.length];
- mount.getxattr(path, "attr2", out);
+ mount.getxattr(path, "user.attr2", out);
outStr = new String(out);
assertTrue(outStr.compareTo(val2) == 0);