cephfs: enable test cases with ceph issues that have been fixed

Ceph issue https://tracker.ceph.com/issues/46084 has been fixed with
backports to nautilus and octopus. Re-enable the relevant test data
and fix up the tests to match.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-01-18 16:45:27 -05:00 committed by mergify[bot]
parent 134c628df1
commit c995d63088
3 changed files with 15 additions and 14 deletions

View File

@ -34,8 +34,9 @@ const (
// SetXattr sets an extended attribute on the open file. // SetXattr sets an extended attribute on the open file.
// //
// NOTE: Attempting to set an xattr value with an empty value may cause // NOTE: Attempting to set an xattr value with an empty value may cause the
// the xattr to be unset. Please refer to https://tracker.ceph.com/issues/46084 // xattr to be unset on some older versions of ceph.
// Please refer to https://tracker.ceph.com/issues/46084
// //
// Implements: // Implements:
// int ceph_fsetxattr(struct ceph_mount_info *cmount, int fd, const char *name, // int ceph_fsetxattr(struct ceph_mount_info *cmount, int fd, const char *name,

View File

@ -24,15 +24,12 @@ var xattrSamples = []struct {
name: "user.x2kZeros", name: "user.x2kZeros",
value: make([]byte, 2048), value: make([]byte, 2048),
}, },
// Ceph's behavior when an empty value is supplied may be considered // Older versions of ceph had a bug where using an empty value caused the
// to have a bug in some versions. Using an empty value may cause // xattr to be unset. This has been fixed for nautilus and octopus.
// the xattr to be unset. Please refer to: {
// https://tracker.ceph.com/issues/46084 name: "user.xEmpty",
// So we avoid testing for that case explicitly here. value: []byte(""),
//{ },
// name: "user.xEmpty",
// value: []byte(""),
//},
} }
func TestGetSetXattr(t *testing.T) { func TestGetSetXattr(t *testing.T) {
@ -111,10 +108,11 @@ func TestListXattr(t *testing.T) {
} }
xl, err := f.ListXattr() xl, err := f.ListXattr()
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, xl, 3) assert.Len(t, xl, 4)
assert.Contains(t, xl, xattrSamples[0].name) assert.Contains(t, xl, xattrSamples[0].name)
assert.Contains(t, xl, xattrSamples[1].name) assert.Contains(t, xl, xattrSamples[1].name)
assert.Contains(t, xl, xattrSamples[2].name) assert.Contains(t, xl, xattrSamples[2].name)
assert.Contains(t, xl, xattrSamples[3].name)
}) })
t.Run("invalidFile", func(t *testing.T) { t.Run("invalidFile", func(t *testing.T) {

View File

@ -84,10 +84,11 @@ func TestListXattrPath(t *testing.T) {
} }
xl, err := mount.ListXattr(fname) xl, err := mount.ListXattr(fname)
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, xl, 3) assert.Len(t, xl, 4)
assert.Contains(t, xl, xattrSamples[0].name) assert.Contains(t, xl, xattrSamples[0].name)
assert.Contains(t, xl, xattrSamples[1].name) assert.Contains(t, xl, xattrSamples[1].name)
assert.Contains(t, xl, xattrSamples[2].name) assert.Contains(t, xl, xattrSamples[2].name)
assert.Contains(t, xl, xattrSamples[3].name)
}) })
t.Run("invalidMount", func(t *testing.T) { t.Run("invalidMount", func(t *testing.T) {
@ -237,10 +238,11 @@ func TestListXattrLinkPath(t *testing.T) {
} }
xl, err := mount.LlistXattr(lname) xl, err := mount.LlistXattr(lname)
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, xl, 3) assert.Len(t, xl, 4)
assert.Contains(t, xl, xattrSamples[0].name) assert.Contains(t, xl, xattrSamples[0].name)
assert.Contains(t, xl, xattrSamples[1].name) assert.Contains(t, xl, xattrSamples[1].name)
assert.Contains(t, xl, xattrSamples[2].name) assert.Contains(t, xl, xattrSamples[2].name)
assert.Contains(t, xl, xattrSamples[3].name)
}) })
t.Run("invalidMount", func(t *testing.T) { t.Run("invalidMount", func(t *testing.T) {