Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cephfs: Adjust with the fallocate API changes #1045

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions cephfs/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

anoopcs9 marked this conversation as resolved.
Show resolved Hide resolved
func TestFileOpen(t *testing.T) {
mount := fsConnect(t)
defer fsDisconnect(t, mount)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down