fix(backend): secure production startup and migrations

This commit is contained in:
2026-07-22 13:11:30 +08:00
parent 0daea4def9
commit 7980943660
13 changed files with 220 additions and 43 deletions

View File

@@ -0,0 +1,20 @@
//go:build integration
package testutil
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestPostgresSchemaDSNSupportsURLAndKeywordFormats(t *testing.T) {
urlDSN, err := postgresSchemaDSN("postgres://user:pass@localhost:5432/db?sslmode=disable", "senlin_test_abc")
require.NoError(t, err)
require.Contains(t, urlDSN, "sslmode=disable")
require.Contains(t, urlDSN, "search_path=senlin_test_abc")
keywordDSN, err := postgresSchemaDSN("host=localhost dbname=db sslmode=disable", "senlin_test_abc")
require.NoError(t, err)
require.Equal(t, "host=localhost dbname=db sslmode=disable search_path=senlin_test_abc", keywordDSN)
}