mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
fix(migration) datastore always marked new and migrations skipped EE-1775 (#5788)
* fix issue with broken store init * minor logic improvement * Remove fileexists logic as its redundant and handled implicitely by bolt.Open * Added re-open test on IsNew flag. Essential for migrations to be able to run
This commit is contained in:
parent
fc4ff59bfd
commit
6bd72d21a8
4 changed files with 20 additions and 25 deletions
|
@ -17,12 +17,23 @@ func testVersion(store *Store, versionWant int, t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMigrateData(t *testing.T) {
|
||||
t.Run("MigrateData for New Store", func(t *testing.T) {
|
||||
t.Run("MigrateData for New Store & Re-Open Check", func(t *testing.T) {
|
||||
store, teardown := MustNewTestStore(false)
|
||||
defer teardown()
|
||||
|
||||
if !store.IsNew() {
|
||||
t.Error("Expect a new DB")
|
||||
}
|
||||
|
||||
store.MigrateData(false)
|
||||
|
||||
testVersion(store, portainer.DBVersion, t)
|
||||
store.Close()
|
||||
|
||||
store.Open()
|
||||
if store.IsNew() {
|
||||
t.Error("Expect store to NOT be new DB")
|
||||
}
|
||||
})
|
||||
|
||||
tests := []struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue