mirror of
https://github.com/ceph/go-ceph
synced 2024-12-20 13:21:32 +00:00
36196c5e60
In a previous commit we added fsDisconnect to match with fsConnect. For tests that do not use fsConnect but still acquire resources we need to free up those resources with direct calls to the appropriate functions. Signed-off-by: John Mulligan <jmulligan@redhat.com>
35 lines
715 B
Go
35 lines
715 B
Go
// +build !luminous,!mimic
|
|
|
|
package cephfs
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGetFsCid(t *testing.T) {
|
|
t.Run("unmounted", func(t *testing.T) {
|
|
mount, err := CreateMount()
|
|
defer func() { assert.NoError(t, mount.Release()) }()
|
|
require.NoError(t, err)
|
|
require.NotNil(t, mount)
|
|
|
|
err = mount.ReadDefaultConfigFile()
|
|
require.NoError(t, err)
|
|
|
|
cid, err := mount.GetFsCid()
|
|
assert.Error(t, err)
|
|
assert.Equal(t, cid, int64(0))
|
|
})
|
|
t.Run("mounted", func(t *testing.T) {
|
|
mount := fsConnect(t)
|
|
defer fsDisconnect(t, mount)
|
|
|
|
cid, err := mount.GetFsCid()
|
|
assert.NoError(t, err)
|
|
assert.GreaterOrEqual(t, cid, int64(0))
|
|
})
|
|
}
|