feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
63
spec/factories/messages.go
Обычный файл
63
spec/factories/messages.go
Обычный файл
@@ -0,0 +1,63 @@
|
||||
package factories
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/lib/pq"
|
||||
|
||||
"rsgit.ru/rsmon/rsmon/app/models"
|
||||
)
|
||||
|
||||
// MessageFactory provides functionality.
|
||||
func MessageFactory() models.Message {
|
||||
ts := time.Date(2019, time.January, 3, 3, 4, 4, 0, time.UTC)
|
||||
|
||||
monitor := MonitorFactory(nil, "test monitor")
|
||||
check := CheckFactory(&monitor, "http")
|
||||
e := "testerr"
|
||||
check.Error = &e
|
||||
|
||||
event := models.Event{
|
||||
Monitor: &monitor,
|
||||
StartTime: &ts,
|
||||
EndTime: nil,
|
||||
Duration: 60,
|
||||
Errors: 3,
|
||||
Oks: 0,
|
||||
State: "current",
|
||||
Reason: "test error",
|
||||
|
||||
ChecksDown: pq.StringArray{check.Kind},
|
||||
Checks: []models.Check{
|
||||
check,
|
||||
},
|
||||
}
|
||||
|
||||
message := models.Message{
|
||||
Contact: &models.Contact{
|
||||
Kind: "email",
|
||||
},
|
||||
Kind: "down",
|
||||
Events: []models.Event{
|
||||
event,
|
||||
},
|
||||
}
|
||||
|
||||
return message
|
||||
}
|
||||
|
||||
// ExpMessageFactory provides functionality.
|
||||
func ExpMessageFactory() models.Message {
|
||||
monitor := MonitorFactory(nil, "test monitor")
|
||||
check := CheckFactory(&monitor, "http")
|
||||
|
||||
message := models.Message{
|
||||
Contact: &models.Contact{
|
||||
Kind: "email",
|
||||
},
|
||||
Kind: "exp",
|
||||
Check: &check,
|
||||
}
|
||||
|
||||
return message
|
||||
}
|
||||
Ссылка в новой задаче
Block a user