From 8f3beb622fa4f5c70ee30d42edf58968026b3586 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Tue, 12 Nov 2024 16:06:44 +0530 Subject: [PATCH] cephfs: Skip fallocate with mode 0 test on main There has been an internal change with fallocate API[1] forcing us not to run those fallocate tests which uses mode as 0. For now we skip those tests on main branch. [1] https://github.com/ceph/ceph/pull/59725 Signed-off-by: Anoop C S --- cephfs/file_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cephfs/file_test.go b/cephfs/file_test.go index 0859dcd..aea7f6e 100644 --- a/cephfs/file_test.go +++ b/cephfs/file_test.go @@ -8,6 +8,26 @@ import ( "github.com/stretchr/testify/assert" ) +var ( + serverVersion string +) + +const ( + cephOctopus = "octopus" + cephPacfic = "pacific" + cephQuincy = "quincy" + cephReef = "reef" + cephSquid = "squid" + cephMain = "main" +) + +func init() { + switch vname := os.Getenv("CEPH_VERSION"); vname { + case cephOctopus, cephPacfic, cephQuincy, cephReef, cephSquid, cephMain: + serverVersion = vname + } +} + func TestFileOpen(t *testing.T) { mount := fsConnect(t) defer fsDisconnect(t, mount) @@ -492,6 +512,10 @@ func TestFallocate(t *testing.T) { // Allocate space - default case, mode == 0. t.Run("modeIsZero", func(t *testing.T) { + if serverVersion == cephMain { + t.Skip("fallocate with mode 0 is unsupported: https://tracker.ceph.com/issues/68026") + } + // check file size. sx, err := mount.Statx(fname, StatxBasicStats, 0) assert.NoError(t, err) @@ -507,6 +531,10 @@ func TestFallocate(t *testing.T) { // Allocate space - size increases, data remains intact. t.Run("increaseSize", func(t *testing.T) { + if serverVersion == cephMain { + t.Skip("fallocate with mode 0 is unsupported: https://tracker.ceph.com/issues/68026") + } + fname := "file2.txt" f1, err := mount.Open(fname, os.O_RDWR|os.O_CREATE, 0644) assert.NoError(t, err)