mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-03 15:06:36 +08:00
[优化] go 引用调整
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package migrate
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMigrationsAreContinuousFromBaseVersion(t *testing.T) {
|
||||
migrations := Migrations()
|
||||
if len(migrations) == 0 {
|
||||
t.Fatal("expected at least one registered migration")
|
||||
}
|
||||
expectedFrom := BaseDatabaseSchemaVersion
|
||||
for _, migration := range migrations {
|
||||
if migration.FromVersion != expectedFrom {
|
||||
t.Fatalf("expected migration from v%d, got v%d -> v%d", expectedFrom, migration.FromVersion, migration.ToVersion)
|
||||
}
|
||||
if migration.ToVersion != migration.FromVersion+1 {
|
||||
t.Fatalf("expected one-step migration, got v%d -> v%d", migration.FromVersion, migration.ToVersion)
|
||||
}
|
||||
expectedFrom = migration.ToVersion
|
||||
}
|
||||
if CurrentVersion() != expectedFrom {
|
||||
t.Fatalf("unexpected current version: got %d want %d", CurrentVersion(), expectedFrom)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user