pgsql: Add test for migrations

This commit is contained in:
Sida Chen 2019-03-06 16:33:42 -05:00
parent ea418cffd4
commit 497b79a293

View File

@ -12,22 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package pgsql
package migrations_test
import (
"testing"
"github.com/coreos/clair/database/pgsql/migrations"
"github.com/coreos/clair/database/pgsql/testutil"
_ "github.com/lib/pq"
"github.com/remind101/migrate"
"github.com/stretchr/testify/require"
"github.com/coreos/clair/database/pgsql/migrations"
)
var userTableCount = `SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname='public'`
func TestMigration(t *testing.T) {
db, cleanup := createAndConnectTestDB(t, "TestMigration")
db, cleanup := testutil.CreateAndConnectTestDB(t, "TestMigration")
defer cleanup()
err := migrate.NewPostgresMigrator(db).Exec(migrate.Up, migrations.Migrations...)