mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
* chore: Move httpmw to /coderd directory httpmw is specific to coderd and should be scoped under coderd * chore: Move httpapi to /coderd directory httpapi is specific to coderd and should be scoped under coderd * chore: Move database to /coderd directory database is specific to coderd and should be scoped under coderd * chore: Update codecov & gitattributes for generated files * chore: Update Makefile
39 lines
606 B
Go
39 lines
606 B
Go
//go:build linux
|
|
|
|
package postgres_test
|
|
|
|
import (
|
|
"database/sql"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"go.uber.org/goleak"
|
|
|
|
"github.com/coder/coder/coderd/database/postgres"
|
|
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
goleak.VerifyTestMain(m)
|
|
}
|
|
|
|
func TestPostgres(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
if testing.Short() {
|
|
t.Skip()
|
|
return
|
|
}
|
|
|
|
connect, close, err := postgres.Open()
|
|
require.NoError(t, err)
|
|
defer close()
|
|
db, err := sql.Open("postgres", connect)
|
|
require.NoError(t, err)
|
|
err = db.Ping()
|
|
require.NoError(t, err)
|
|
err = db.Close()
|
|
require.NoError(t, err)
|
|
}
|