Skip to content

Commit

Permalink
TestDowngradeNoop: make test more exhaustive
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoack committed Oct 14, 2024
1 parent fb3ad84 commit 479ddab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions landlock/restrict_downgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package landlock

import (
"fmt"
"testing"

ll "github.com/landlock-lsm/go-landlock/landlock/syscall"
Expand Down Expand Up @@ -109,11 +110,14 @@ func TestDowngradeNetwork(t *testing.T) {
}

func TestDowngradeNoop(t *testing.T) {
cfg := V5.BestEffort()
abi := abiInfos[5]
gotCfg, _ := downgrade(cfg, []Rule{}, abi)
for _, abi := range abiInfos {
t.Run(fmt.Sprintf("V%v", abi.version), func(t *testing.T) {
cfg := abi.asConfig().BestEffort()
gotCfg, _ := downgrade(cfg, []Rule{}, abi)

if gotCfg != cfg {
t.Errorf("downgrade should have been a no-op.\n got %v,\nwant %v", gotCfg, cfg)
if gotCfg != cfg {
t.Errorf("downgrade should have been a no-op.\n got %v,\nwant %v", gotCfg, cfg)
}
})
}
}

0 comments on commit 479ddab

Please sign in to comment.