feat: patch run service - dispatch, results, reboot verification, cancel, alerts, retention
This commit is contained in:
@@ -11,6 +11,10 @@ import (
|
||||
// monitor check. MonitorName carries the hostname in that case.
|
||||
const TypeServer = "server"
|
||||
|
||||
// TypePatch marks a patch run summary. Like a vulnerability digest it is a
|
||||
// headline, not a transition, so title() adds no verb.
|
||||
const TypePatch = "patch"
|
||||
|
||||
type Event struct {
|
||||
MonitorName string
|
||||
Type string
|
||||
@@ -26,7 +30,7 @@ func (e Event) title() string {
|
||||
verb = "is DOWN"
|
||||
}
|
||||
var s string
|
||||
if e.Type == TypeVuln {
|
||||
if e.Type == TypeVuln || e.Type == TypePatch {
|
||||
// A digest is not a transition. MonitorName already carries the whole
|
||||
// headline ("12 new critical across 4 servers"), so no verb applies.
|
||||
s = fmt.Sprintf("[Vantage] %s", e.MonitorName)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.hostxtra.co.uk/mrhid6/vantage/server/internal/models"
|
||||
)
|
||||
|
||||
// A patch summary is not a transition: it must not read "is DOWN" or
|
||||
// "recovered".
|
||||
func TestPatchEventTitle(t *testing.T) {
|
||||
ev := Event{MonitorName: `Patch policy "Sunday prod" partial`, Type: TypePatch, NewStatus: models.PatchRunPartial, Message: "38 succeeded, 2 failed"}
|
||||
want := `[Vantage] Patch policy "Sunday prod" partial: 38 succeeded, 2 failed`
|
||||
if got := ev.title(); got != want {
|
||||
t.Fatalf("got %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user