Files
wehub-resource-sync 75f3dd141c
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CI and Release / lint-frontend (push) Has been cancelled
CI and Release / dockerfile-scan (push) Has been cancelled
CI and Release / test-frontend (push) Has been cancelled
CI and Release / lint-verification-agent (push) Has been cancelled
CI and Release / test-verification-agent (push) Has been cancelled
CI and Release / e2e-verification-agent (push) Has been cancelled
CI and Release / test-backend (push) Has been cancelled
CI and Release / build-dev-image (push) Has been cancelled
CI and Release / push-dev-image (push) Has been cancelled
CI and Release / build-image (push) Has been cancelled
CI and Release / build-verification-image (push) Has been cancelled
CI and Release / determine-version (push) Has been cancelled
CI and Release / push-image (push) Has been cancelled
CI and Release / push-verification-image (12) (push) Has been cancelled
CI and Release / lint-backend (push) Has been cancelled
CI and Release / push-verification-image (17) (push) Has been cancelled
CI and Release / push-verification-image (18) (push) Has been cancelled
CI and Release / release (push) Has been cancelled
CI and Release / publish-helm-chart (push) Has been cancelled
CI and Release / push-verification-image (13) (push) Has been cancelled
CI and Release / push-verification-image (14) (push) Has been cancelled
CI and Release / push-verification-image (15) (push) Has been cancelled
CI and Release / push-verification-image (16) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:11:07 +08:00

33 lines
1.5 KiB
Go

// Package physicaltesting holds the shared control plane, helpers and version-parameterized bodies
// for the PostgreSQL physical backup→restore E2E tests. The per-version packages (pg17, pg18) are
// thin wrappers that call the exported Run* bodies, so each PostgreSQL major runs as its own test
// binary — isolated and in parallel under `go test -p`.
package physicaltesting
import (
"testing"
backuping_physical "databasus-backend/internal/features/backups/backups/backuping/physical"
cache_utils "databasus-backend/internal/util/cache"
)
// Setup starts the single-instance production wiring the whole suite drives through the HTTP
// API: the scheduler (which invokes its in-process backuper directly) and the WAL stream supervisor.
// With both up, a backup requested over the API (config-enable bootstrap for the FULL, the trigger
// endpoint for incrementals) is claimed on the next 1s scheduler tick and run to a terminal state,
// and enabling WAL-stream backups makes the supervisor claim the database and create its replication
// slot. The returned func tears them down after m.Run(). Each version package calls this in its own
// TestMain, so the two majors run with fully isolated control planes.
func Setup() func() {
_ = cache_utils.ClearAllCache()
backuping_physical.SetupDependencies()
stopScheduler := backuping_physical.StartPhysicalSchedulerForTest(&testing.T{})
stopWalStreamSupervisor := backuping_physical.StartPhysicalWalStreamSupervisorForTest(&testing.T{})
return func() {
stopWalStreamSupervisor()
stopScheduler()
}
}