From 50b2f41ed948a2a47420d8edc9abca2d477eccfb Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 10 Feb 2023 11:38:05 +0100 Subject: pkg/subsystem: detect loops on the go This lets us reduce the amount of code in parents.go. --- pkg/subsystem/linux/parents_test.go | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'pkg/subsystem/linux/parents_test.go') diff --git a/pkg/subsystem/linux/parents_test.go b/pkg/subsystem/linux/parents_test.go index f1942671d..dde13177d 100644 --- a/pkg/subsystem/linux/parents_test.go +++ b/pkg/subsystem/linux/parents_test.go @@ -69,21 +69,6 @@ func TestDropDuplicateSubsystems(t *testing.T) { assert.ElementsMatch(t, ret, expected) } -func TestLoopsDoExist(t *testing.T) { - a := &entity.Subsystem{} - b := &entity.Subsystem{Parents: []*entity.Subsystem{a}} - c := &entity.Subsystem{Parents: []*entity.Subsystem{b}} - a.Parents = []*entity.Subsystem{c} - assert.True(t, loopsExist([]*entity.Subsystem{a, b, c})) -} - -func TestLoopsDoNotExist(t *testing.T) { - a := &entity.Subsystem{} - b := &entity.Subsystem{Parents: []*entity.Subsystem{a}} - c := &entity.Subsystem{Parents: []*entity.Subsystem{b}} - assert.False(t, loopsExist([]*entity.Subsystem{a, b, c})) -} - func TestTransitiveReduction(t *testing.T) { // (d, c), (c, b), (b, a) // (d, a) -- cgit mrf-deployment