mirror of
https://github.com/juanfont/headscale.git
synced 2025-11-25 03:46:06 -05:00
db: remove _schema from migration tests
Previously we tested migrations on schemas and dumps of old databases. The problems with testing migrations against the schemas is that the migration table is empty, so we try to run migrations that are already ran on that schema, which might blow up. This commit removes the schema approach and just leaves all the dumps, which include the migration table. Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
committed by
Kristoffer Dalby
parent
249630bed8
commit
1c146f70e9
@@ -315,11 +315,10 @@ func dbForTestWithPath(t *testing.T, sqlFilePath string) *HSDatabase {
|
||||
// in the testdata directory. It verifies they can be successfully migrated to the current
|
||||
// schema version. This test only validates migration success, not data integrity.
|
||||
//
|
||||
// A lot of the schemas have been automatically generated with old Headscale binaries on empty databases
|
||||
// (no user/node data):
|
||||
// - `headscale_<VERSION>_schema.sql` (created with `sqlite3 headscale.db .schema`)
|
||||
// - `headscale_<VERSION>_dump.sql` (created with `sqlite3 headscale.db .dump`)
|
||||
// where `_dump.sql` contains the migration steps that have been applied to the database.
|
||||
// All test database files are SQL dumps (created with `sqlite3 headscale.db .dump`) generated
|
||||
// with old Headscale binaries on empty databases (no user/node data). These dumps include the
|
||||
// migration history in the `migrations` table, which allows the migration system to correctly
|
||||
// skip already-applied migrations and only run new ones.
|
||||
func TestSQLiteAllTestdataMigrations(t *testing.T) {
|
||||
t.Parallel()
|
||||
schemas, err := os.ReadDir("testdata/sqlite")
|
||||
|
||||
Reference in New Issue
Block a user