Skip to content

Commit ce7a0d9

Browse files
committed
Add migration test
1 parent 178d6dc commit ce7a0d9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2025 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_24 //nolint
5+
6+
import (
7+
"testing"
8+
9+
"code.gitea.io/gitea/models/migrations/base"
10+
)
11+
12+
func TestMain(m *testing.M) {
13+
base.MainTest(m)
14+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2025 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_24 //nolint
5+
6+
import (
7+
"testing"
8+
9+
"code.gitea.io/gitea/models/migrations/base"
10+
"github.com/stretchr/testify/assert"
11+
)
12+
13+
func Test_Ini2UI(t *testing.T) {
14+
// Prepare and load the testing database
15+
x, deferable := base.PrepareTestEnv(t, 0)
16+
defer deferable()
17+
if x == nil || t.Failed() {
18+
return
19+
}
20+
21+
assert.NoError(t, MigrateIniToDatabase(x))
22+
23+
cnt, err := x.Table("system_setting").Where(`setting_key LIKE "ui.%"`).Count()
24+
assert.NoError(t, err)
25+
assert.EqualValues(t, 23, cnt)
26+
}

0 commit comments

Comments
 (0)