Files
weichenandCursor 19bc78d6c0 Add the C5 backup and PITR drill
Why: The checklist had no measured restore path for a physical backup, WAL archive, or pg_dump onto a new target.
Evidence: bash -n, go test in tests/ops/drill_driver, and run_backup_drill.sh --self-check passed locally (SELF). The timed run is recorded separately.
Impact: Isolated u7bk only. Upload responses keep artifactId so the restore check can download the same objects.
Refs: feature/u7-ops-drills
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 14:55:48 +00:00

31 lines
1.0 KiB
Go

package main
import "testing"
func TestArtifactIDFromUpload(t *testing.T) {
if got := artifactIDFromUpload([]byte(`{"artifactId":"art_1","filename":"a.txt"}`)); got != "art_1" {
t.Fatalf("artifactId = %q", got)
}
if got := artifactIDFromUpload([]byte(`{"id":"art_2"}`)); got != "art_2" {
t.Fatalf("id = %q", got)
}
}
func TestAttemptInWindow(t *testing.T) {
cases := []struct {
started, since, until string
want bool
}{
{"2026-10-12T13:37:55.091216802Z", "2026-10-12T13:37:57Z", "2026-10-12T13:38:57Z", false},
{"2026-10-12T13:37:57Z", "2026-10-12T13:37:57Z", "2026-10-12T13:38:57Z", true},
{"2026-10-12T13:38:57.000000001Z", "2026-10-12T13:37:57Z", "2026-10-12T13:38:57Z", false},
{"2026-10-12T13:38:10.5Z", "", "", true},
{"not-a-time", "2026-10-12T13:37:57Z", "2026-10-12T13:38:57Z", false},
}
for _, tc := range cases {
if got := attemptInWindow(tc.started, tc.since, tc.until); got != tc.want {
t.Errorf("attemptInWindow(%s, %s, %s) = %v, want %v", tc.started, tc.since, tc.until, got, tc.want)
}
}
}