lib/config: Refactor migrations a bit (#5750)

This breaks out config migrations to a separate concept, making it
(imho) slightly easier to maintain and get an overview.
This commit is contained in:
Jakob Borg
2019-05-29 11:37:44 +02:00
committed by GitHub
parent e714df013f
commit 5ce5b2c94a
3 changed files with 360 additions and 376 deletions

View File

@@ -766,6 +766,8 @@ func TestV14ListenAddressesMigration(t *testing.T) {
},
}
m := migration{14, migrateToConfigV14}
for _, tc := range tcs {
cfg := Configuration{
Version: 13,
@@ -774,7 +776,7 @@ func TestV14ListenAddressesMigration(t *testing.T) {
DeprecatedRelayServers: tc[1],
},
}
convertV13V14(&cfg)
m.apply(&cfg)
if cfg.Version != 14 {
t.Error("Configuration was not converted")
}