/
log_event_mock.go
59 lines (53 loc) · 1.17 KB
/
log_event_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package mongo
import (
"context"
v1 "github.com/klovercloud-ci-cd/core-engine/core/v1"
"github.com/klovercloud-ci-cd/core-engine/core/v1/repository"
"time"
)
var data []v1.LogEvent
// InitLogEventData Return mock Log event list
func InitLogEventData() []v1.LogEvent {
data = []v1.LogEvent{
{
ProcessId: "1",
Log: "Initializing pod",
Step: "buildImage",
CreatedAt: time.Time{},
},
{
ProcessId: "1",
Log: "Pulling Image",
Step: "buildImage",
CreatedAt: time.Time{},
},
{
ProcessId: "2",
Log: "Failed to initialize pod",
Step: "buildImage",
CreatedAt: time.Time{},
},
{
ProcessId: "2",
Log: "Initializing pod",
Step: "deployImage",
CreatedAt: time.Time{},
},
{
ProcessId: "2",
Log: "Pulling Image",
Step: "deployImage",
CreatedAt: time.Time{},
},
}
return data
}
// NewMockLogEventRepository returns LogEventRepository type object
func NewMockLogEventRepository() repository.LogEventRepository {
manager := GetMockDmManager()
manager.Db.Drop(context.Background())
return &logEventRepository{
manager: GetMockDmManager(),
timeout: 3000,
}
}