2020-02-14 15:00:21 +00:00
|
|
|
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()
|
2020-03-23 20:58:15 +00:00
|
|
|
defer func() { assert.NoError(t, mount.Release()) }()
|
2020-02-14 15:00:21 +00:00
|
|
|
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)
|
2020-03-23 21:11:12 +00:00
|
|
|
defer fsDisconnect(t, mount)
|
2020-02-14 15:00:21 +00:00
|
|
|
|
|
|
|
cid, err := mount.GetFsCid()
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.GreaterOrEqual(t, cid, int64(0))
|
|
|
|
})
|
|
|
|
}
|