diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-02-22 14:01:47 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2023-02-22 14:26:22 +0100 |
| commit | 83146efec51146c4e6fafd530ebd9d29584e2288 (patch) | |
| tree | 68d7441775780bb8d3320920e1550220c12e4cbc /pkg/subsystem/service_test.go | |
| parent | 409945bc8fab54efa11597029f5c9704bf0cbc22 (diff) | |
pkg/subsystem: query child subsystems
Let the Service also serve the child subsystem query requests.
Diffstat (limited to 'pkg/subsystem/service_test.go')
| -rw-r--r-- | pkg/subsystem/service_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/subsystem/service_test.go b/pkg/subsystem/service_test.go new file mode 100644 index 000000000..2a95b9558 --- /dev/null +++ b/pkg/subsystem/service_test.go @@ -0,0 +1,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}) + assert.ElementsMatch(t, service.Children(parent), []*Subsystem{childA, childB}) +} |
