Skip to content

Commit b1778a0

Browse files
committed
fix test, move sqlite3 message
1 parent e5fc5ff commit b1778a0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

models/unittest/testdb.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ func MainTest(m *testing.M, testOpts *TestOptions) {
8989
}
9090

9191
if err = CreateTestEngine(opts); err != nil {
92-
_, _ = fmt.Fprintln(os.Stderr, `sqlite3 requires: import _ "github.com/mattn/go-sqlite3" or -tags sqlite,sqlite_unlock_notify`)
9392
fatalTestError("Error creating test engine: %v\n", err)
9493
}
9594

@@ -203,6 +202,9 @@ type FixturesOptions struct {
203202
func CreateTestEngine(opts FixturesOptions) error {
204203
x, err := xorm.NewEngine("sqlite3", "file::memory:?cache=shared&_txlock=immediate")
205204
if err != nil {
205+
if strings.Contains(err.Error(), "unknown driver") {
206+
return fmt.Errorf(`sqlite3 requires: import _ "github.com/mattn/go-sqlite3" or -tags sqlite,sqlite_unlock_notify%s%w`, "\n", err)
207+
}
206208
return err
207209
}
208210
x.SetMapper(names.GonicMapper{})

services/pull/check_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
issues_model "code.gitea.io/gitea/models/issues"
1313
"code.gitea.io/gitea/models/unittest"
1414
"code.gitea.io/gitea/modules/queue"
15+
"code.gitea.io/gitea/modules/setting"
1516

1617
"github.com/stretchr/testify/assert"
1718
)
@@ -28,7 +29,7 @@ func TestPullRequest_AddToTaskQueue(t *testing.T) {
2829
}
2930
return nil
3031
}
31-
iniCfg := queue.IniConfig{Length: 10, BatchLength: 1, Workers: 1}
32+
iniCfg := setting.QueueSettings{Length: 10, BatchLength: 1, MaxWorkers: 1}
3233
prPatchCheckerQueue = queue.NewWorkerPoolQueueBySetting("pr_patch_checker", iniCfg, testHandler, true)
3334

3435
var queueShutdown []func()

0 commit comments

Comments
 (0)