Skip to content

Commit a631884

Browse files
committed
test: fix null pointer
1 parent 0e56f39 commit a631884

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

services/tasks/TaskRunner_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package tasks
22

33
import (
44
"github.com/semaphoreui/semaphore/pkg/task_logger"
5+
"github.com/semaphoreui/semaphore/pro_interfaces"
56
"math/rand"
67
"os"
78
"path"
@@ -48,6 +49,20 @@ func (s *EncryptionServiceMock) FillEnvironmentSecrets(env *db.Environment, dese
4849
return nil
4950
}
5051

52+
type mockLogWriteService struct {
53+
}
54+
55+
func (l *mockLogWriteService) WriteEventLog(event pro_interfaces.EventLogRecord) error {
56+
return nil
57+
}
58+
59+
func (l *mockLogWriteService) WriteTaskLog(task pro_interfaces.TaskLogRecord) error {
60+
return nil
61+
}
62+
func (l *mockLogWriteService) WriteResult(task any) error {
63+
return nil
64+
}
65+
5166
func TestTaskRunnerRun(t *testing.T) {
5267

5368
store := bolt.CreateTestStore()
@@ -59,7 +74,7 @@ func TestTaskRunnerRun(t *testing.T) {
5974
&InventoryServiceMock{},
6075
nil,
6176
keyInstaller,
62-
nil,
77+
&mockLogWriteService{},
6378
)
6479

6580
go pool.Run()

0 commit comments

Comments
 (0)