Skip to content

Commit

Permalink
Add tests for the reverse policy filter mapping
Browse files Browse the repository at this point in the history
Signed-off-by: Anastasios Papagiannis <[email protected]>
  • Loading branch information
tpapagian committed Dec 13, 2024
1 parent 0607f97 commit 3d357e4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/policyfilter/map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,20 @@ func requirePfmEqualTo(t *testing.T, m PfMap, val map[uint64][]uint64) {
}
}

checkReverseVals := map[CgroupID]map[PolicyID]struct{}{}
for k, ids := range val {
for _, id := range ids {
if checkReverseVals[CgroupID(id)] == nil {
checkReverseVals[CgroupID(id)] = map[PolicyID]struct{}{}
}
checkReverseVals[CgroupID(id)][PolicyID(k)] = struct{}{}
}
}

mapVals, err := m.readAll()
require.NoError(t, err)
require.EqualValues(t, checkVals, mapVals.Direct)
require.EqualValues(t, checkReverseVals, mapVals.Reverse)
}

// TestPfMapOps tests some simple map operations
Expand Down

0 comments on commit 3d357e4

Please sign in to comment.