- Add worker storage layer with PostgreSQL/sqlc setup - Add migration files for worker backbone schema - Add job runner and built-in jobs implementation - Add Redis key definitions for worker state management - Archive socket-session-loop milestone (completed/renamed) - Update roadmap current.md and foundation-alignment phase - Add socket endpoint integration and runtime smoke tests - Add infra-check, worker-storage-check, worker-storage-gen CLI tools - Update API socket server and config - Add pubspec dependencies and client socket endpoint changes - Add config tests for API and worker services
30 lines
920 B
Go
30 lines
920 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDatabaseURLLogMetadataRedactsPassword(t *testing.T) {
|
|
rawURL := "postgres://alt:alt_secret_password@localhost:5432/alt?sslmode=disable"
|
|
redacted := redactDatabaseURL(rawURL)
|
|
|
|
if strings.Contains(redacted, "alt_secret_password") {
|
|
t.Errorf("expected password to be redacted, but redacted string still contains password: %s", redacted)
|
|
}
|
|
|
|
expected := "postgres://alt:xxxxx@localhost:5432/alt?sslmode=disable"
|
|
if redacted != expected {
|
|
t.Errorf("redacted URL mismatch: got %q, want %q", redacted, expected)
|
|
}
|
|
}
|
|
|
|
func TestDatabaseURLLogMetadataRejectsRawSecret(t *testing.T) {
|
|
// Handles invalid URL format gracefully
|
|
invalidURL := "postgres://a b" // spaces are invalid in url.Parse
|
|
redacted := redactDatabaseURL(invalidURL)
|
|
|
|
if redacted != "[invalid database url]" {
|
|
t.Errorf("expected invalid URL to be handled gracefully, got %q", redacted)
|
|
}
|
|
}
|