Add guarded IP certificate flow and renewal history
This commit is contained in:
1 parent
dd94a4cc84
commit
d3699abb18
14 files changed
+343
-56
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package tlsservice
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReadRenewalEventsAcceptsOnlyBoundedValidRecords(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "renewals.log")
|
||||
content := "2026-10-26T08:00:00Z\ttest-link.appx365.com\n" +
|
||||
"2026-10-26T09:00:00Z\t121.4.111.208\n" +
|
||||
"invalid\t121.4.111.208\n" +
|
||||
"2026-10-26T10:00:00Z\t../bad\n"
|
||||
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
events := readRenewalEvents(path)
|
||||
if len(events) != 2 || events[0].Host != "121.4.111.208" || events[1].Host != "test-link.appx365.com" {
|
||||
t.Fatalf("renewal events = %+v", events)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user