Skip to content

Commit

Permalink
Test composite subsytem
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorespert committed Jan 4, 2025
1 parent 2d377be commit d48b4a7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions controller/subsystem_composite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package controller

import "testing"

func TestSubsystemComposite(t *testing.T) {
s := NewSubsystemComposite()

if _, err := s.Sub("noop"); err == nil {
t.Error("Expected error for unknown subsystem")
}

s.Load("noop", NoopSubsystem())
if _, err := s.Sub("noop"); err != nil {
t.Error("Expected no error for known subsystem")
}
s.Unload("noop")
if _, err := s.Sub("noop"); err == nil {
t.Error("Expected error for unknown subsystem")
}

s.Load("noop", NoopSubsystem())

if err := s.Setup(); err != nil {
t.Error(err)
}

s.UnloadAll()

if _, err := s.Sub("noop"); err == nil {
t.Error("Expected error for unknown subsystem")
}
}

0 comments on commit d48b4a7

Please sign in to comment.