mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
* chore: Add pubsub Exposes new in-memory and PostgreSQL pubsubs. This will be used for negotiating WebRTC connections. * Don't run PostgreSQL tests on non-Linux
34 lines
553 B
Go
34 lines
553 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/database/postgres"
|
|
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
goleak.VerifyTestMain(m)
|
|
}
|
|
|
|
func TestPostgres(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
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)
|
|
}
|