diff options
| author | 2025-05-22 12:26:11 +0200 | |
|---|---|---|
| committer | 2025-05-22 12:26:11 +0200 | |
| commit | d5c9c4adc167cdb05e73f5105702cf340293e61c (patch) | |
| tree | 1d21fe376099864900837eba675a965517f98e5d /internal/processing/admin | |
| parent | [feature] Allow exposing allows, implement `/api/v1/domain_blocks` and `/api/... (diff) | |
| download | gotosocial-d5c9c4adc167cdb05e73f5105702cf340293e61c.tar.xz | |
[chore] Upgrade to Go 1.24 (#4187)
* Set `go.mod` to 1.24 now that it's been out for 3 months.
* Update all the test to use `testing.T.Context()`.
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4187
Co-authored-by: Daenney <git@noreply.sourcery.dny.nu>
Co-committed-by: Daenney <git@noreply.sourcery.dny.nu>
Diffstat (limited to 'internal/processing/admin')
| -rw-r--r-- | internal/processing/admin/account_test.go | 5 | ||||
| -rw-r--r-- | internal/processing/admin/domainpermission_test.go | 10 | ||||
| -rw-r--r-- | internal/processing/admin/emoji_test.go | 3 | ||||
| -rw-r--r-- | internal/processing/admin/signupapprove_test.go | 3 | ||||
| -rw-r--r-- | internal/processing/admin/signupreject_test.go | 7 | ||||
| -rw-r--r-- | internal/processing/admin/workertask_test.go | 4 |
6 files changed, 14 insertions, 18 deletions
diff --git a/internal/processing/admin/account_test.go b/internal/processing/admin/account_test.go index 76c4c82f5..34eb1d2fd 100644 --- a/internal/processing/admin/account_test.go +++ b/internal/processing/admin/account_test.go @@ -18,7 +18,6 @@ package admin_test import ( - "context" "testing" apimodel "code.superseriousbusiness.org/gotosocial/internal/api/model" @@ -33,7 +32,7 @@ type AccountTestSuite struct { func (suite *AccountTestSuite) TestAccountActionSuspend() { var ( - ctx = context.Background() + ctx = suite.T().Context() adminAcct = suite.testAccounts["admin_account"] request = &apimodel.AdminActionRequest{ Category: gtsmodel.AdminActionCategoryAccount.String(), @@ -79,7 +78,7 @@ func (suite *AccountTestSuite) TestAccountActionSuspend() { func (suite *AccountTestSuite) TestAccountActionUnsupported() { var ( - ctx = context.Background() + ctx = suite.T().Context() adminAcct = suite.testAccounts["admin_account"] request = &apimodel.AdminActionRequest{ Category: gtsmodel.AdminActionCategoryAccount.String(), diff --git a/internal/processing/admin/domainpermission_test.go b/internal/processing/admin/domainpermission_test.go index f53c241b6..fccb9e10f 100644 --- a/internal/processing/admin/domainpermission_test.go +++ b/internal/processing/admin/domainpermission_test.go @@ -82,7 +82,7 @@ func (suite *DomainBlockTestSuite) runDomainPermTest(t domainPermTest) { config.SetInstanceFederationMode(t.instanceFederationMode) for _, action := range t.actions { - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(suite.T().Context()) defer cancel() // Run the desired action. @@ -102,7 +102,7 @@ func (suite *DomainBlockTestSuite) runDomainPermTest(t domainPermTest) { // Check expected results // against each account. accounts, err := suite.db.GetInstanceAccounts( - context.Background(), + suite.T().Context(), action.domain, "", 0, ) @@ -123,7 +123,7 @@ func (suite *DomainBlockTestSuite) createDomainPerm( permissionType gtsmodel.DomainPermissionType, domain string, ) (*apimodel.DomainPermission, string) { - ctx := context.Background() + ctx := suite.T().Context() apiPerm, actionID, errWithCode := suite.adminProcessor.DomainPermissionCreate( ctx, @@ -148,7 +148,7 @@ func (suite *DomainBlockTestSuite) deleteDomainPerm( domain string, ) (*apimodel.DomainPermission, string) { var ( - ctx = context.Background() + ctx = suite.T().Context() domainPermission gtsmodel.DomainPermission ) @@ -183,7 +183,7 @@ func (suite *DomainBlockTestSuite) deleteDomainPerm( // waits for given actionID to be completed. func (suite *DomainBlockTestSuite) awaitAction(actionID string) { - ctx := context.Background() + ctx := suite.T().Context() if !testrig.WaitFor(func() bool { return suite.state.AdminActions.TotalRunning() == 0 diff --git a/internal/processing/admin/emoji_test.go b/internal/processing/admin/emoji_test.go index 4968ad1af..b050cefe8 100644 --- a/internal/processing/admin/emoji_test.go +++ b/internal/processing/admin/emoji_test.go @@ -18,7 +18,6 @@ package admin_test import ( - "context" "testing" apimodel "code.superseriousbusiness.org/gotosocial/internal/api/model" @@ -32,7 +31,7 @@ type EmojiTestSuite struct { } func (suite *EmojiTestSuite) TestUpdateEmojiCategory() { - ctx := context.Background() + ctx := suite.T().Context() testEmoji := new(gtsmodel.Emoji) *testEmoji = *suite.testEmojis["rainbow"] diff --git a/internal/processing/admin/signupapprove_test.go b/internal/processing/admin/signupapprove_test.go index 7203c3223..5739325c2 100644 --- a/internal/processing/admin/signupapprove_test.go +++ b/internal/processing/admin/signupapprove_test.go @@ -18,7 +18,6 @@ package admin_test import ( - "context" "testing" "code.superseriousbusiness.org/gotosocial/internal/gtsmodel" @@ -32,7 +31,7 @@ type AdminApproveTestSuite struct { func (suite *AdminApproveTestSuite) TestApprove() { var ( - ctx = context.Background() + ctx = suite.T().Context() adminAcct = suite.testAccounts["admin_account"] targetAcct = suite.testAccounts["unconfirmed_account"] targetUser = new(gtsmodel.User) diff --git a/internal/processing/admin/signupreject_test.go b/internal/processing/admin/signupreject_test.go index 2017c6364..ea517f579 100644 --- a/internal/processing/admin/signupreject_test.go +++ b/internal/processing/admin/signupreject_test.go @@ -18,7 +18,6 @@ package admin_test import ( - "context" "testing" "code.superseriousbusiness.org/gotosocial/internal/db" @@ -33,7 +32,7 @@ type AdminRejectTestSuite struct { func (suite *AdminRejectTestSuite) TestReject() { var ( - ctx = context.Background() + ctx = suite.T().Context() adminAcct = suite.testAccounts["admin_account"] targetAcct = suite.testAccounts["unconfirmed_account"] targetUser = suite.testUsers["unconfirmed_account"] @@ -95,7 +94,7 @@ func (suite *AdminRejectTestSuite) TestReject() { func (suite *AdminRejectTestSuite) TestRejectRemote() { var ( - ctx = context.Background() + ctx = suite.T().Context() adminAcct = suite.testAccounts["admin_account"] targetAcct = suite.testAccounts["remote_account_1"] privateComment = "It's a no from me chief." @@ -117,7 +116,7 @@ func (suite *AdminRejectTestSuite) TestRejectRemote() { func (suite *AdminRejectTestSuite) TestRejectApproved() { var ( - ctx = context.Background() + ctx = suite.T().Context() adminAcct = suite.testAccounts["admin_account"] targetAcct = suite.testAccounts["local_account_1"] privateComment = "It's a no from me chief." diff --git a/internal/processing/admin/workertask_test.go b/internal/processing/admin/workertask_test.go index 37b7059d7..8ce0a3436 100644 --- a/internal/processing/admin/workertask_test.go +++ b/internal/processing/admin/workertask_test.go @@ -94,7 +94,7 @@ type WorkerTaskTestSuite struct { } func (suite *WorkerTaskTestSuite) TestFillWorkerQueues() { - ctx, cncl := context.WithCancel(context.Background()) + ctx, cncl := context.WithCancel(suite.T().Context()) defer cncl() var tasks []*gtsmodel.WorkerTask @@ -255,7 +255,7 @@ func (suite *WorkerTaskTestSuite) TestFillWorkerQueues() { } func (suite *WorkerTaskTestSuite) TestPersistWorkerQueues() { - ctx, cncl := context.WithCancel(context.Background()) + ctx, cncl := context.WithCancel(suite.T().Context()) defer cncl() // Push all test worker tasks to their respective queues. |
