mirror of https://github.com/ceph/go-ceph
cephfs: Add a separate test file for fallocate with mode 0
There are backports created for fallocate API changes[1] that got merged recently. Considering the time taken for these backports to get in to release branches and finally as a released version we create a separate test file to have more fine grained control over various pre-release CI jobs with the help of corresponding build tags. Modification of build tags should go hand-in-hand with the version detection logic used in file_test.go once a backport is available in released version. [1] https://github.com/ceph/ceph/pull/59725 Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
This commit is contained in:
parent
8f3beb622f
commit
ab45bcd33a
|
@ -37,6 +37,9 @@ var (
|
||||||
ErrNotConnected = getError(-C.ENOTCONN)
|
ErrNotConnected = getError(-C.ENOTCONN)
|
||||||
// ErrNotExist indicates a non-specific missing resource.
|
// ErrNotExist indicates a non-specific missing resource.
|
||||||
ErrNotExist = getError(-C.ENOENT)
|
ErrNotExist = getError(-C.ENOENT)
|
||||||
|
// ErrOpNotSupported is returned in general for operations that are not
|
||||||
|
// supported.
|
||||||
|
ErrOpNotSupported = getError(-C.EOPNOTSUPP)
|
||||||
|
|
||||||
// Private errors:
|
// Private errors:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
//go:build main
|
||||||
|
|
||||||
|
package cephfs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestFallocateModeZeroUnsupported and this test file exists merely to track
|
||||||
|
// the backports for https://tracker.ceph.com/issues/68026. Once they are
|
||||||
|
// available with release versions this can probably vanish.
|
||||||
|
func TestFallocateModeZeroUnsupported(t *testing.T) {
|
||||||
|
mount := fsConnect(t)
|
||||||
|
defer fsDisconnect(t, mount)
|
||||||
|
fname := "file1.txt"
|
||||||
|
f, err := mount.Open(fname, os.O_RDWR|os.O_CREATE, 0644)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NotNil(t, f)
|
||||||
|
defer func() {
|
||||||
|
assert.NoError(t, f.Close())
|
||||||
|
assert.NoError(t, mount.Unlink(fname))
|
||||||
|
}()
|
||||||
|
|
||||||
|
err = f.Fallocate(FallocNoFlag, 0, 10)
|
||||||
|
assert.Error(t, err)
|
||||||
|
assert.Equal(t, ErrOpNotSupported, err)
|
||||||
|
}
|
Loading…
Reference in New Issue