Skip to content

Commit ce5ac79

Browse files
committed
fix
1 parent 775421e commit ce5ac79

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

models/unittest/fixtures_loader.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func (f *fixturesLoader) prepareFieldValue(v any) any {
3131
}
3232
return v
3333
}
34+
3435
func (f *fixturesLoader) loadFixtures(file string) error {
3536
data, err := os.ReadFile(file)
3637
if err != nil {
@@ -51,10 +52,8 @@ func (f *fixturesLoader) loadFixtures(file string) error {
5152

5253
switch f.engine.Dialect().URI().DBType {
5354
case schemas.MSSQL:
54-
_, _ = f.engine.Exec("SET IDENTITY_INSERT [%s] ON", tableName)
55-
defer func() {
56-
_, _ = f.engine.Exec("SET IDENTITY_INSERT [%s] OFF", tableName)
57-
}()
55+
_, _ = f.engine.Exec(fmt.Sprintf("SET IDENTITY_INSERT `%s` ON", tableName))
56+
// we can't revert this behavior, because some tests also depends on this, for example: Test_UpdateBadgeColName
5857
}
5958

6059
var sqlBuf []byte

modules/system/appstate_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ func (*testItem2) Name() string {
3636
}
3737

3838
func TestAppStateDB(t *testing.T) {
39-
assert.NoError(t, unittest.PrepareTestDatabase())
40-
4139
as := &DBStore{}
4240

4341
item1 := new(testItem1)

0 commit comments

Comments
 (0)