diff options
| author | 2023-03-01 18:26:53 +0000 | |
|---|---|---|
| committer | 2023-03-01 18:26:53 +0000 | |
| commit | baf933cb9f3e1053bdb61b90d7027efe9fad1bc2 (patch) | |
| tree | 3f2a76851d58517ca3dece2bacd6aceefd8dfb96 /internal/api/wellknown | |
| parent | [feature] Federate pinned posts (aka `featuredCollection`) in and out (#1560) (diff) | |
| download | gotosocial-baf933cb9f3e1053bdb61b90d7027efe9fad1bc2.tar.xz | |
[chore] move client/federator workerpools to Workers{} (#1575)
* replace concurrency worker pools with base models in State.Workers, update code and tests accordingly
* improve code comment
* change back testrig default log level
* un-comment-out TestAnnounceTwice() and fix
---------
Signed-off-by: kim <grufwub@gmail.com>
Reviewed-by: tobi
Diffstat (limited to 'internal/api/wellknown')
| -rw-r--r-- | internal/api/wellknown/webfinger/webfinger_test.go | 21 | ||||
| -rw-r--r-- | internal/api/wellknown/webfinger/webfingerget_test.go | 10 | 
2 files changed, 14 insertions, 17 deletions
| diff --git a/internal/api/wellknown/webfinger/webfinger_test.go b/internal/api/wellknown/webfinger/webfinger_test.go index 38228e928..3148279c5 100644 --- a/internal/api/wellknown/webfinger/webfinger_test.go +++ b/internal/api/wellknown/webfinger/webfinger_test.go @@ -26,15 +26,14 @@ import (  	"github.com/stretchr/testify/suite"  	"github.com/superseriousbusiness/gotosocial/internal/ap"  	"github.com/superseriousbusiness/gotosocial/internal/api/wellknown/webfinger" -	"github.com/superseriousbusiness/gotosocial/internal/concurrency"  	"github.com/superseriousbusiness/gotosocial/internal/db"  	"github.com/superseriousbusiness/gotosocial/internal/email"  	"github.com/superseriousbusiness/gotosocial/internal/federation"  	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"  	"github.com/superseriousbusiness/gotosocial/internal/media" -	"github.com/superseriousbusiness/gotosocial/internal/messages"  	"github.com/superseriousbusiness/gotosocial/internal/oauth"  	"github.com/superseriousbusiness/gotosocial/internal/processing" +	"github.com/superseriousbusiness/gotosocial/internal/state"  	"github.com/superseriousbusiness/gotosocial/internal/storage"  	"github.com/superseriousbusiness/gotosocial/internal/typeutils"  	"github.com/superseriousbusiness/gotosocial/testrig" @@ -44,6 +43,7 @@ type WebfingerStandardTestSuite struct {  	// standard suite interfaces  	suite.Suite  	db           db.DB +	state        state.State  	tc           typeutils.TypeConverter  	mediaManager media.Manager  	federator    federation.Federator @@ -76,19 +76,21 @@ func (suite *WebfingerStandardTestSuite) SetupSuite() {  }  func (suite *WebfingerStandardTestSuite) SetupTest() { +	suite.state.Caches.Init() +	testrig.StartWorkers(&suite.state) +  	testrig.InitTestLog()  	testrig.InitTestConfig() -	clientWorker := concurrency.NewWorkerPool[messages.FromClientAPI](-1, -1) -	fedWorker := concurrency.NewWorkerPool[messages.FromFederator](-1, -1) - -	suite.db = testrig.NewTestDB() +	suite.db = testrig.NewTestDB(&suite.state) +	suite.state.DB = suite.db  	suite.tc = testrig.NewTestTypeConverter(suite.db)  	suite.storage = testrig.NewInMemoryStorage() -	suite.mediaManager = testrig.NewTestMediaManager(suite.db, suite.storage) -	suite.federator = testrig.NewTestFederator(suite.db, testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil, "../../../../testrig/media"), suite.db, fedWorker), suite.storage, suite.mediaManager, fedWorker) +	suite.state.Storage = suite.storage +	suite.mediaManager = testrig.NewTestMediaManager(&suite.state) +	suite.federator = testrig.NewTestFederator(&suite.state, testrig.NewTestTransportController(&suite.state, testrig.NewMockHTTPClient(nil, "../../../../testrig/media")), suite.mediaManager)  	suite.emailSender = testrig.NewEmailSender("../../../../web/template/", nil) -	suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator, suite.emailSender, suite.mediaManager, clientWorker, fedWorker) +	suite.processor = testrig.NewTestProcessor(&suite.state, suite.federator, suite.emailSender, suite.mediaManager)  	suite.webfingerModule = webfinger.New(suite.processor)  	suite.oauthServer = testrig.NewTestOauthServer(suite.db)  	testrig.StandardDBSetup(suite.db, suite.testAccounts) @@ -100,6 +102,7 @@ func (suite *WebfingerStandardTestSuite) SetupTest() {  func (suite *WebfingerStandardTestSuite) TearDownTest() {  	testrig.StandardDBTeardown(suite.db)  	testrig.StandardStorageTeardown(suite.storage) +	testrig.StopWorkers(&suite.state)  }  func accountDomainAccount() *gtsmodel.Account { diff --git a/internal/api/wellknown/webfinger/webfingerget_test.go b/internal/api/wellknown/webfinger/webfingerget_test.go index 7587dfee1..a345d0602 100644 --- a/internal/api/wellknown/webfinger/webfingerget_test.go +++ b/internal/api/wellknown/webfinger/webfingerget_test.go @@ -30,9 +30,7 @@ import (  	"github.com/stretchr/testify/suite"  	"github.com/superseriousbusiness/gotosocial/internal/api/wellknown/webfinger" -	"github.com/superseriousbusiness/gotosocial/internal/concurrency"  	"github.com/superseriousbusiness/gotosocial/internal/config" -	"github.com/superseriousbusiness/gotosocial/internal/messages"  	"github.com/superseriousbusiness/gotosocial/internal/processing"  	"github.com/superseriousbusiness/gotosocial/testrig"  ) @@ -91,9 +89,7 @@ func (suite *WebfingerGetTestSuite) TestFingerUserWithDifferentAccountDomainByHo  	config.SetHost("gts.example.org")  	config.SetAccountDomain("example.org") -	clientWorker := concurrency.NewWorkerPool[messages.FromClientAPI](-1, -1) -	fedWorker := concurrency.NewWorkerPool[messages.FromFederator](-1, -1) -	suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaManager(suite.db, suite.storage), suite.storage, suite.db, suite.emailSender, clientWorker, fedWorker) +	suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaManager(&suite.state), &suite.state, suite.emailSender)  	suite.webfingerModule = webfinger.New(suite.processor)  	targetAccount := accountDomainAccount() @@ -148,9 +144,7 @@ func (suite *WebfingerGetTestSuite) TestFingerUserWithDifferentAccountDomainByAc  	config.SetHost("gts.example.org")  	config.SetAccountDomain("example.org") -	clientWorker := concurrency.NewWorkerPool[messages.FromClientAPI](-1, -1) -	fedWorker := concurrency.NewWorkerPool[messages.FromFederator](-1, -1) -	suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaManager(suite.db, suite.storage), suite.storage, suite.db, suite.emailSender, clientWorker, fedWorker) +	suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaManager(&suite.state), &suite.state, suite.emailSender)  	suite.webfingerModule = webfinger.New(suite.processor)  	targetAccount := accountDomainAccount() | 
