aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/service_test.go
blob: d45a628064cf390dbce5910eab791f35875fa6be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2023 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package subsystem

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestServiceChildren(t *testing.T) {
	unrelated := &Subsystem{Name: "unrelated"}
	parent := &Subsystem{Name: "parent"}
	childA := &Subsystem{Name: "childA", Parents: []*Subsystem{parent}}
	childB := &Subsystem{Name: "childB", Parents: []*Subsystem{parent}}
	service := MustMakeService([]*Subsystem{unrelated, parent, childA, childB}, 1)
	assert.ElementsMatch(t, service.Children(parent), []*Subsystem{childA, childB})
}