summaryrefslogtreecommitdiff
path: root/internal/processing/account/account_test.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-04-28 13:23:11 +0100
committerLibravatar GitHub <noreply@github.com>2022-04-28 13:23:11 +0100
commit420e2fb22bc7aa4967ddadb11e444079efdf5117 (patch)
tree413842c5df646c30a8079671ade5e677e3825fb8 /internal/processing/account/account_test.go
parent[bugfix] Fix possible race condition in federatingdb (#490) (diff)
downloadgotosocial-420e2fb22bc7aa4967ddadb11e444079efdf5117.tar.xz
replace async client API / federator msg processing with worker pools (#497)
* replace async client API / federator msg processing with worker pools * appease our lord-and-saviour, the linter
Diffstat (limited to 'internal/processing/account/account_test.go')
-rw-r--r--internal/processing/account/account_test.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/internal/processing/account/account_test.go b/internal/processing/account/account_test.go
index aff4f02aa..33b744250 100644
--- a/internal/processing/account/account_test.go
+++ b/internal/processing/account/account_test.go
@@ -19,6 +19,8 @@
package account_test
import (
+ "context"
+
"codeberg.org/gruf/go-store/kv"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/pub"
@@ -33,6 +35,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/processing/account"
"github.com/superseriousbusiness/gotosocial/internal/transport"
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
+ "github.com/superseriousbusiness/gotosocial/internal/worker"
"github.com/superseriousbusiness/gotosocial/testrig"
)
@@ -78,6 +81,16 @@ func (suite *AccountStandardTestSuite) SetupTest() {
testrig.InitTestLog()
testrig.InitTestConfig()
+ fedWorker := worker.New[messages.FromFederator](-1, -1)
+ clientWorker := worker.New[messages.FromClientAPI](-1, -1)
+ clientWorker.SetProcessor(func(_ context.Context, msg messages.FromClientAPI) error {
+ suite.fromClientAPIChan <- msg
+ return nil
+ })
+
+ _ = fedWorker.Start()
+ _ = clientWorker.Start()
+
suite.db = testrig.NewTestDB()
suite.tc = testrig.NewTestTypeConverter(suite.db)
suite.storage = testrig.NewTestStorage()
@@ -85,11 +98,11 @@ func (suite *AccountStandardTestSuite) SetupTest() {
suite.oauthServer = testrig.NewTestOauthServer(suite.db)
suite.fromClientAPIChan = make(chan messages.FromClientAPI, 100)
suite.httpClient = testrig.NewMockHTTPClient(nil)
- suite.transportController = testrig.NewTestTransportController(suite.httpClient, suite.db)
- suite.federator = testrig.NewTestFederator(suite.db, suite.transportController, suite.storage, suite.mediaManager)
+ suite.transportController = testrig.NewTestTransportController(suite.httpClient, suite.db, fedWorker)
+ suite.federator = testrig.NewTestFederator(suite.db, suite.transportController, suite.storage, suite.mediaManager, fedWorker)
suite.sentEmails = make(map[string]string)
suite.emailSender = testrig.NewEmailSender("../../../web/template/", suite.sentEmails)
- suite.accountProcessor = account.New(suite.db, suite.tc, suite.mediaManager, suite.oauthServer, suite.fromClientAPIChan, suite.federator, processing.GetParseMentionFunc(suite.db, suite.federator))
+ suite.accountProcessor = account.New(suite.db, suite.tc, suite.mediaManager, suite.oauthServer, clientWorker, suite.federator, processing.GetParseMentionFunc(suite.db, suite.federator))
testrig.StandardDBSetup(suite.db, nil)
testrig.StandardStorageSetup(suite.storage, "../../../testrig/media")
}