Files
agent/backend/internal/testutil/postgres_integration_test.go

21 lines
651 B
Go

//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)
}