Skip to content

Commit f655075

Browse files
committed
test: fix TestNotif*
TestNotif should check not only for API level >= 6, but also for libseccomp >= 2.5.0. Use notifSupported() to fix. Same applies to TestNotifUnsupported. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 370002f commit f655075

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

seccomp_test.go

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -795,23 +795,8 @@ func TestNotif(t *testing.T) {
795795
}
796796

797797
func subprocessNotif(t *testing.T) {
798-
// seccomp notification requires API level >= 6
799-
api, err := GetAPI()
800-
if err != nil {
801-
if !APILevelIsSupported() {
802-
t.Skipf("Skipping test: %s", err)
803-
}
804-
805-
t.Errorf("Error getting API level: %s", err)
806-
} else {
807-
t.Logf("Got API level %v", api)
808-
if api < 6 {
809-
err = SetAPI(6)
810-
if err != nil {
811-
t.Skipf("Skipping test: API level %d is less than 6 and could not set it to 6", api)
812-
return
813-
}
814-
}
798+
if err := notifSupported(); err != nil {
799+
t.Skip(err)
815800
}
816801

817802
arch, err := GetNativeArch()
@@ -963,15 +948,8 @@ func TestNotifUnsupported(t *testing.T) {
963948
}
964949

965950
func subprocessNotifUnsupported(t *testing.T) {
966-
// seccomp notification requires API level >= 6
967-
api := 0
968-
if APILevelIsSupported() {
969-
api, err := GetAPI()
970-
if err != nil {
971-
t.Errorf("Error getting API level: %s", err)
972-
} else if api >= 6 {
973-
t.Skipf("Skipping test for old libseccomp support: API level %d is >= 6", api)
974-
}
951+
if err := notifSupported(); err == nil {
952+
t.Skip("seccomp notification is supported")
975953
}
976954

977955
filter, err := NewFilter(ActAllow)

0 commit comments

Comments
 (0)