make tests pass with "go test -count n" with n > 1

by closing initialized resources during tests.
This commit is contained in:
Mechiel Lukkien
2024-06-10 18:18:20 +02:00
parent dde2258f69
commit f56b04805b
9 changed files with 50 additions and 40 deletions

View File

@ -230,6 +230,7 @@ func TestAccount(t *testing.T) {
err = queue.Init() // For DB.
tcheck(t, err, "queue init")
defer queue.Shutdown()
account, _, _, _ := api.Account(ctx)
@ -250,6 +251,9 @@ func TestAccount(t *testing.T) {
api.AccountSaveFullName(ctx, account.FullName)
go ImportManage()
defer func() {
importers.Stop <- struct{}{}
}()
// Import mbox/maildir tgz/zip.
testImport := func(filename string, expect int) {