aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/entities_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-02-07 16:10:48 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-16 11:29:36 +0100
commit6e13575de15a4d480e4edf604d5f83ca3ee1c64e (patch)
treedc09d46db51c8f7fa7a4df1c852dea016fdb2ac2 /pkg/subsystem/entities_test.go
parent18376b101dad0dcfb0797275661184c753cbb2d9 (diff)
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.
Diffstat (limited to 'pkg/subsystem/entities_test.go')
-rw-r--r--pkg/subsystem/entities_test.go18
1 files changed, 18 insertions, 0 deletions
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",
+ })
+}