//go:build integration

package models

import (
	"os"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestPostgresPing(t *testing.T) {
	dsn := os.Getenv("DATABASE_DSN")
	if dsn == "" {
		dsn = os.Getenv("DATABASE_URL")
	}
	require.NotEmpty(t, dsn, "DATABASE_DSN or DATABASE_URL is required for integration tests")

	database, err := Open(dsn)
	require.NoError(t, err)
	sqlDB, err := database.DB()
	require.NoError(t, err)
	require.NoError(t, sqlDB.Ping())
}
