mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 07:54:07 +01:00
Merge pull request '[v7.0/forgejo] [FEAT] Mark database errors in tests as failure' (#2978) from bp-v7.0/forgejo-2dabd20 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2978 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
a89e146cb0
2 changed files with 10 additions and 1 deletions
|
@ -155,8 +155,14 @@ func InitEngine(ctx context.Context) error {
|
||||||
Logger: log.GetLogger("xorm"),
|
Logger: log.GetLogger("xorm"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errorLogger := log.GetLogger("xorm")
|
||||||
|
if setting.IsInTesting {
|
||||||
|
errorLogger = log.GetLogger(log.DEFAULT)
|
||||||
|
}
|
||||||
|
|
||||||
xormEngine.AddHook(&ErrorQueryHook{
|
xormEngine.AddHook(&ErrorQueryHook{
|
||||||
Logger: log.GetLogger("xorm"),
|
Logger: errorLogger,
|
||||||
})
|
})
|
||||||
|
|
||||||
SetDefaultEngine(ctx, xormEngine)
|
SetDefaultEngine(ctx, xormEngine)
|
||||||
|
|
|
@ -357,6 +357,9 @@ var ignoredErrorMessage = []string{
|
||||||
|
|
||||||
// TestRenameInvalidUsername
|
// TestRenameInvalidUsername
|
||||||
`TrString() [E] Missing translation "form.Name"`,
|
`TrString() [E] Missing translation "form.Name"`,
|
||||||
|
|
||||||
|
// TestDatabaseCollation
|
||||||
|
`[E] [Error SQL Query] INSERT INTO test_collation_tbl (txt) VALUES ('main') []`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *testLoggerWriterCloser) recordError(msg string) {
|
func (w *testLoggerWriterCloser) recordError(msg string) {
|
||||||
|
|
Loading…
Reference in a new issue