refactor: spooled handler (#752)

* refactor: spooled handler

* fix(spooler): test locked channel
This commit is contained in:
Silvan
2020-09-18 13:39:28 +02:00
committed by GitHub
parent 320ddfa46d
commit ee0383cae8
2 changed files with 41 additions and 44 deletions
@@ -293,15 +293,20 @@ func TestSpooler_lock(t *testing.T) {
}
errs := make(chan error, 1)
defer close(errs)
ctx, _ := context.WithDeadline(context.Background(), tt.args.deadline)
locked := s.lock(ctx, errs, "test-worker")
if tt.fields.expectsErr {
lock := <-locked
err := <-errs
if err == nil {
t.Error("No error in error queue")
}
if lock {
t.Error("lock should have failed")
}
} else {
lock := <-locked
if !lock {