"context"
"fmt"
"os"
- "reflect"
"strconv"
"strings"
"sync"
maxEntries = 16
)
-func mapsEqual(a, b *Map) bool {
- return a.name == b.name &&
- reflect.DeepEqual(a.spec, b.spec)
+func mapsEqual(t *testing.T, expected, actual *Map) {
+ t.Helper()
+ require.Equal(t, expected.name, actual.name, "map names should match")
+ require.Equal(t, expected.spec, actual.spec, "map specs should match")
}
func TestPrivilegedOpen(t *testing.T) {
openedMap, err = OpenMap(MapPath(logger, "cilium_test"), &TestKey{}, &TestValue{})
require.NoError(t, err)
- require.True(t, mapsEqual(openedMap, testMap))
+ mapsEqual(t, testMap, openedMap)
}
func TestPrivilegedOpenOrCreate(t *testing.T) {
require.Error(t, err)
// Check OpenMap warning section
- require.True(t, mapsEqual(parallelMap, testMap))
+ mapsEqual(t, testMap, parallelMap)
key1 := &TestKey{Key: 101}
value1 := &TestValue{Value: 201}