-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure database is migrated to the current version before testing
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package db_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/appuio/appuio-cloud-reporting/pkg/db" | ||
"github.com/appuio/appuio-cloud-reporting/pkg/db/dbtest" | ||
"github.com/stretchr/testify/require" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type MigrationTestSuite struct { | ||
dbtest.Suite | ||
} | ||
|
||
func (s *MigrationTestSuite) TestMigrations_DatabaseShouldBeFullyMigrated() { | ||
t := s.T() | ||
pending, err := db.Pending(s.DB().DB) | ||
require.NoError(t, err) | ||
require.Lenf(t, pending, 0, "the test database should be migrated to the newest version before running tests") | ||
} | ||
|
||
func TestMigrations(t *testing.T) { | ||
suite.Run(t, new(MigrationTestSuite)) | ||
} |