From 6e13575de15a4d480e4edf604d5f83ca3ee1c64e Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 7 Feb 2023 16:10:48 +0100 Subject: pkg/subsystem: extract emails list For the subsystem itself, we take both maintainers and lists. But from all parents we only take lists, because otherwise too many unrelated people might be notified. --- pkg/subsystem/entities_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pkg/subsystem/entities_test.go') diff --git a/pkg/subsystem/entities_test.go b/pkg/subsystem/entities_test.go index df65dbd5a..58166b91b 100644 --- a/pkg/subsystem/entities_test.go +++ b/pkg/subsystem/entities_test.go @@ -21,3 +21,21 @@ func TestReachableParents(t *testing.T) { } assert.ElementsMatch(t, retParents, []*Subsystem{parentA, parentB, parentParent}) } + +func TestSubsystemEmails(t *testing.T) { + parentParent := &Subsystem{Lists: []string{"a@list.com"}, Maintainers: []string{"a@person.com"}} + parent1 := &Subsystem{Lists: []string{"b@list.com"}, Maintainers: []string{"b@person.com"}} + parent2 := &Subsystem{ + Lists: []string{"c@list.com"}, + Maintainers: []string{"c@person.com"}, + Parents: []*Subsystem{parentParent}, + } + subsystem := &Subsystem{ + Lists: []string{"d@list.com"}, + Maintainers: []string{"d@person.com"}, + Parents: []*Subsystem{parent1, parent2}, + } + assert.ElementsMatch(t, subsystem.Emails(), []string{ + "a@list.com", "b@list.com", "c@list.com", "d@list.com", "d@person.com", + }) +} -- cgit mrf-deployment