fix logger test and locker test
This commit is contained in:
@@ -38,6 +38,10 @@ func TestNewLogger(t *testing.T) {
|
|||||||
"error",
|
"error",
|
||||||
LogLevelError,
|
LogLevelError,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Less than error",
|
||||||
|
-1,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|||||||
+2
-2
@@ -1024,6 +1024,7 @@ func (t *testLocker) Lock(_ context.Context, _ string) (Lock, error) {
|
|||||||
if t.jobLocked {
|
if t.jobLocked {
|
||||||
return nil, fmt.Errorf("job already locked")
|
return nil, fmt.Errorf("job already locked")
|
||||||
}
|
}
|
||||||
|
t.jobLocked = true
|
||||||
return &testLock{}, nil
|
return &testLock{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1056,7 +1057,6 @@ func TestScheduler_WithDistributed(t *testing.T) {
|
|||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
elector := &testElector{}
|
|
||||||
jobsRan := make(chan struct{}, 20)
|
jobsRan := make(chan struct{}, 20)
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
schedulersDone := make(chan struct{}, tt.count)
|
schedulersDone := make(chan struct{}, tt.count)
|
||||||
@@ -1064,7 +1064,7 @@ func TestScheduler_WithDistributed(t *testing.T) {
|
|||||||
for i := tt.count; i > 0; i-- {
|
for i := tt.count; i > 0; i-- {
|
||||||
go func() {
|
go func() {
|
||||||
s, err := newTestScheduler(
|
s, err := newTestScheduler(
|
||||||
WithDistributedElector(elector),
|
tt.opt,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user