summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-22 09:53:32 +0200
committerPaul Buetow <paul@buetow.org>2026-01-22 09:53:32 +0200
commit4efabb7053c9e02c4cd1c0b687ba8b53e23ffa2b (patch)
tree8101ef690d982f40225312564488c7658b830694 /internal
parent820b4e6c483734ba1d57ecdd28838657d18b3159 (diff)
add SU: (suppressed) count to status summary line
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/html.go7
-rw-r--r--internal/html_test.go18
-rw-r--r--internal/state.go4
3 files changed, 15 insertions, 14 deletions
diff --git a/internal/html.go b/internal/html.go
index 71f17e4..1a55aa3 100644
--- a/internal/html.go
+++ b/internal/html.go
@@ -79,7 +79,7 @@ func (s state) htmlReport(subject string, conf config) string {
numSuppressed := s.countSuppressed(conf)
// Write HTML header with summary
- sb.WriteString(htmlHeader(subject, numCriticals, numWarnings, numUnknown, numStale, numOK))
+ sb.WriteString(htmlHeader(subject, numCriticals, numWarnings, numUnknown, numStale, numSuppressed, numOK))
// Alerts with status changed section
sb.WriteString(`<div class="section">` + "\n")
@@ -292,7 +292,8 @@ func (s state) countStale(conf config) int {
}
// htmlHeader generates the HTML document header with embedded CSS and status summary.
-func htmlHeader(subject string, numCriticals, numWarnings, numUnknown, numStale, numOK int) string {
+// The summary line format is: C:# W:# U:# S:# SU:# OK:#
+func htmlHeader(subject string, numCriticals, numWarnings, numUnknown, numStale, numSuppressed, numOK int) string {
var sb strings.Builder
sb.WriteString(`<!DOCTYPE html>
@@ -341,7 +342,7 @@ func htmlHeader(subject string, numCriticals, numWarnings, numUnknown, numStale,
<div class="container">
<h1>Gogios Status Report</h1>
<div class="summary">C:`)
- sb.WriteString(fmt.Sprintf("%d W:%d U:%d S:%d OK:%d", numCriticals, numWarnings, numUnknown, numStale, numOK))
+ sb.WriteString(fmt.Sprintf("%d W:%d U:%d S:%d SU:%d OK:%d", numCriticals, numWarnings, numUnknown, numStale, numSuppressed, numOK))
sb.WriteString(`</div>
<p>Last Updated: `)
sb.WriteString(time.Now().Format("2006-01-02 15:04:05 MST"))
diff --git a/internal/html_test.go b/internal/html_test.go
index d186e80..485938b 100644
--- a/internal/html_test.go
+++ b/internal/html_test.go
@@ -30,8 +30,8 @@ func TestHtmlStatusBadge(t *testing.T) {
// TestHtmlHeader tests the htmlHeader function.
func TestHtmlHeader(t *testing.T) {
- subject := "GOGIOS Report [C:1 W:2 U:3 S:4 OK:5]"
- result := htmlHeader(subject, 1, 2, 3, 4, 5)
+ subject := "GOGIOS Report [C:1 W:2 U:3 S:4 SU:6 OK:5]"
+ result := htmlHeader(subject, 1, 2, 3, 4, 6, 5)
// Check that the header contains expected elements
expectedElements := []string{
@@ -47,7 +47,7 @@ func TestHtmlHeader(t *testing.T) {
".CRITICAL { color: #dc3545; }",
".WARNING { color: #ff8c00; }",
"Gogios Status Report",
- "C:1 W:2 U:3 S:4 OK:5",
+ "C:1 W:2 U:3 S:4 SU:6 OK:5",
"Last Updated:",
}
@@ -218,7 +218,7 @@ func TestHtmlReport(t *testing.T) {
},
}
- subject := "GOGIOS Report [C:1 W:1 U:0 S:1 OK:2]"
+ subject := "GOGIOS Report [C:1 W:1 U:0 S:0 SU:0 OK:2]"
result := s.htmlReport(subject, config{})
// Check that all major sections are present
@@ -247,8 +247,8 @@ func TestHtmlReport(t *testing.T) {
t.Error("htmlReport() missing warning_check")
}
- // Check status summary
- if !strings.Contains(result, "C:1 W:1 U:0 S:1 OK:2") {
+ // Check status summary (SU:0 because no suppressed checks in config)
+ if !strings.Contains(result, "C:1 W:1 U:0 S:0 SU:0 OK:2") {
t.Error("htmlReport() missing correct status summary")
}
}
@@ -311,7 +311,7 @@ func TestPersistHTMLReport(t *testing.T) {
},
}
- subject := "GOGIOS Report [C:1 W:0 U:0 S:0 OK:0]"
+ subject := "GOGIOS Report [C:1 W:0 U:0 S:0 SU:0 OK:0]"
// Test that the function creates the directory and file
err := persistHTMLReport(s, subject, conf)
@@ -346,7 +346,7 @@ func TestPersistHTMLReport(t *testing.T) {
if !strings.Contains(contentStr, "Test output") {
t.Error("HTML file missing check output")
}
- if !strings.Contains(contentStr, "C:1 W:0 U:0 S:0 OK:0") {
+ if !strings.Contains(contentStr, "C:1 W:0 U:0 S:0 SU:0 OK:0") {
t.Error("HTML file missing status summary")
}
}
@@ -399,7 +399,7 @@ func TestW3CCompliance(t *testing.T) {
},
}
- subject := "GOGIOS Report [C:1 W:0 U:0 S:0 OK:0]"
+ subject := "GOGIOS Report [C:1 W:0 U:0 S:0 SU:0 OK:0]"
html := s.htmlReport(subject, config{})
// W3C HTML5 Required Elements
diff --git a/internal/state.go b/internal/state.go
index 9deb178..b9631b4 100644
--- a/internal/state.go
+++ b/internal/state.go
@@ -169,8 +169,8 @@ func (s state) report(renotify, force bool, statusPageURL string, conf config) (
sb.WriteString("Have a nice day!\n")
- subject := fmt.Sprintf("GOGIOS Report [C:%d W:%d U:%d S:%d OK:%d]",
- numCriticals, numWarnings, numUnknown, numStale, numOK)
+ subject := fmt.Sprintf("GOGIOS Report [C:%d W:%d U:%d S:%d SU:%d OK:%d]",
+ numCriticals, numWarnings, numUnknown, numStale, numSuppressed, numOK)
doNotify := force || (changed || (renotify && hasUnhandled))
return subject, sb.String(), doNotify