fix logger test and locker test

This commit is contained in:
John Roesler 2023-11-14 11:06:16 -06:00
parent 17ea8cad2f
commit 66caa1aabe
No known key found for this signature in database
GPG Key ID: 3AA260B9FCA0A6E1
2 changed files with 6 additions and 2 deletions

View File

@ -38,6 +38,10 @@ func TestNewLogger(t *testing.T) {
"error",
LogLevelError,
},
{
"Less than error",
-1,
},
}
for _, tt := range tests {

View File

@ -1024,6 +1024,7 @@ func (t *testLocker) Lock(_ context.Context, _ string) (Lock, error) {
if t.jobLocked {
return nil, fmt.Errorf("job already locked")
}
t.jobLocked = true
return &testLock{}, nil
}
@ -1056,7 +1057,6 @@ func TestScheduler_WithDistributed(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
elector := &testElector{}
jobsRan := make(chan struct{}, 20)
ctx, cancel := context.WithCancel(context.Background())
schedulersDone := make(chan struct{}, tt.count)
@ -1064,7 +1064,7 @@ func TestScheduler_WithDistributed(t *testing.T) {
for i := tt.count; i > 0; i-- {
go func() {
s, err := newTestScheduler(
WithDistributedElector(elector),
tt.opt,
)
require.NoError(t, err)