mirror of
https://github.com/ceph/go-ceph
synced 2024-12-22 22:24:03 +00:00
rbd/features: add test for FeatureSet
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
d6a88f65b7
commit
a65e39ca3d
@ -1,6 +1,7 @@
|
||||
package rbd
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -49,6 +50,26 @@ func TestGetFeatures(t *testing.T) {
|
||||
assert.True(t, hasLayering, "FeatureLayering is not set")
|
||||
assert.True(t, hasStripingV2, "FeatureStripingV2 is not set")
|
||||
})
|
||||
|
||||
t.Run("compareFeatureSet", func(t *testing.T) {
|
||||
fs := FeatureSet(features)
|
||||
assert.Contains(t, fs.Names(), FeatureNameLayering)
|
||||
assert.Contains(t, fs.Names(), FeatureNameStripingV2)
|
||||
})
|
||||
}
|
||||
|
||||
func TestFeatureSet(t *testing.T) {
|
||||
fsBits := FeatureSet(FeatureExclusiveLock | FeatureDeepFlatten)
|
||||
fsNames := FeatureSetFromNames([]string{FeatureNameExclusiveLock, FeatureNameDeepFlatten})
|
||||
assert.Equal(t, fsBits, fsNames)
|
||||
|
||||
fsBitsSorted := fsBits.Names()
|
||||
sort.Strings(fsBitsSorted)
|
||||
|
||||
fsNamesSorted := fsNames.Names()
|
||||
sort.Strings(fsNamesSorted)
|
||||
|
||||
assert.Equal(t, fsBitsSorted, fsNamesSorted)
|
||||
}
|
||||
|
||||
func TestUpdateFeatures(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user