mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Use reflect.DeepEqual to replace sliceEqual
This commit is contained in:
parent
5d2dbb58d7
commit
f528bce5c6
@ -19,6 +19,7 @@ limitations under the License.
|
|||||||
package mount
|
package mount
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@ -75,24 +76,12 @@ func TestReadProcMountsFrom(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func mountPointsEqual(a, b *MountPoint) bool {
|
func mountPointsEqual(a, b *MountPoint) bool {
|
||||||
if a.Device != b.Device || a.Path != b.Path || a.Type != b.Type || !slicesEqual(a.Opts, b.Opts) || a.Pass != b.Pass || a.Freq != b.Freq {
|
if a.Device != b.Device || a.Path != b.Path || a.Type != b.Type || !reflect.DeepEqual(a.Opts, b.Opts) || a.Pass != b.Pass || a.Freq != b.Freq {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func slicesEqual(a, b []string) bool {
|
|
||||||
if len(a) != len(b) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for i := range a {
|
|
||||||
if a[i] != b[i] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetMountRefs(t *testing.T) {
|
func TestGetMountRefs(t *testing.T) {
|
||||||
fm := &FakeMounter{
|
fm := &FakeMounter{
|
||||||
MountPoints: []MountPoint{
|
MountPoints: []MountPoint{
|
||||||
|
Loading…
Reference in New Issue
Block a user