summaryrefslogtreecommitdiff
path: root/internal/processing/workers
diff options
context:
space:
mode:
authorLibravatar Daenney <git@noreply.sourcery.dny.nu>2025-05-22 12:26:11 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-05-22 12:26:11 +0200
commitd5c9c4adc167cdb05e73f5105702cf340293e61c (patch)
tree1d21fe376099864900837eba675a965517f98e5d /internal/processing/workers
parent[feature] Allow exposing allows, implement `/api/v1/domain_blocks` and `/api/... (diff)
downloadgotosocial-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/workers')
-rw-r--r--internal/processing/workers/fromclientapi_test.go50
-rw-r--r--internal/processing/workers/fromfediapi_test.go62
-rw-r--r--internal/processing/workers/surfacenotify_test.go3
3 files changed, 57 insertions, 58 deletions
diff --git a/internal/processing/workers/fromclientapi_test.go b/internal/processing/workers/fromclientapi_test.go
index a1027f3e0..3abd05295 100644
--- a/internal/processing/workers/fromclientapi_test.go
+++ b/internal/processing/workers/fromclientapi_test.go
@@ -158,7 +158,7 @@ func (suite *FromClientAPITestSuite) checkStreamed(
) {
// Set a 5s timeout on context.
- ctx := context.Background()
+ ctx := suite.T().Context()
ctx, cncl := context.WithTimeout(ctx, time.Second*5)
defer cncl()
@@ -259,7 +259,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithNotification() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
testList = suite.testLists["local_account_1_list_1"]
@@ -376,7 +376,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateBackfilledStatusWithNotifi
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
testList = suite.testLists["local_account_1_list_1"]
@@ -475,7 +475,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateBackfilledStatusWithRemote
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["local_account_1"]
receivingAccount = suite.testAccounts["remote_account_1"]
@@ -531,7 +531,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusReply() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
testList = suite.testLists["local_account_1_list_1"]
@@ -602,7 +602,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusReplyMuted() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
@@ -666,7 +666,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusBoostMuted() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
@@ -734,7 +734,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusListRepliesPolicyLis
*testList = *suite.testLists["local_account_1_list_1"]
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
streams = suite.openStreams(ctx, testStructs.Processor, receivingAccount, []string{testList.ID})
@@ -813,7 +813,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusListRepliesPolicyLis
*testList = *suite.testLists["local_account_1_list_1"]
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
streams = suite.openStreams(ctx, testStructs.Processor, receivingAccount, []string{testList.ID})
@@ -898,7 +898,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusReplyListRepliesPoli
*testList = *suite.testLists["local_account_1_list_1"]
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
streams = suite.openStreams(ctx, testStructs.Processor, receivingAccount, []string{testList.ID})
@@ -973,7 +973,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusBoost() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
testList = suite.testLists["local_account_1_list_1"]
@@ -1040,7 +1040,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusBoostNoReblogs() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_1"]
testList = suite.testLists["local_account_1_list_1"]
@@ -1107,7 +1107,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWhichBeginsConversat
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["local_account_2"]
receivingAccount = suite.testAccounts["local_account_1"]
streams = suite.openStreams(ctx,
@@ -1196,7 +1196,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWhichShouldNotCreate
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["local_account_2"]
receivingAccount = suite.testAccounts["local_account_1"]
streams = suite.openStreams(ctx,
@@ -1269,7 +1269,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithFollowedHashtag(
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_2"]
streams = suite.openStreams(ctx,
@@ -1346,7 +1346,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithFollowedHashtagA
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["remote_account_1"]
receivingAccount = suite.testAccounts["local_account_2"]
streams = suite.openStreams(ctx,
@@ -1430,7 +1430,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateBoostWithFollowedHashtag()
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["remote_account_2"]
boostingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_2"]
@@ -1536,7 +1536,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateBoostWithFollowedHashtagAn
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["remote_account_1"]
boostingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_2"]
@@ -1649,7 +1649,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateBoostWithFollowedHashtagAn
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
boostingAccount = suite.testAccounts["remote_account_1"]
receivingAccount = suite.testAccounts["local_account_2"]
@@ -1760,7 +1760,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithAuthorOnExclusiv
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["local_account_2"]
receivingAccount = suite.testAccounts["local_account_1"]
testList = suite.testLists["local_account_1_list_1"]
@@ -1836,7 +1836,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithAuthorOnExclusiv
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["local_account_2"]
receivingAccount = suite.testAccounts["local_account_1"]
testInclusiveList = suite.testLists["local_account_1_list_1"]
@@ -1953,7 +1953,7 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithAuthorOnExclusiv
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["local_account_2"]
receivingAccount = suite.testAccounts["local_account_1"]
testFollow = suite.testFollows["local_account_1_local_account_2"]
@@ -2080,7 +2080,7 @@ func (suite *FromClientAPITestSuite) TestProcessUpdateStatusWithFollowedHashtag(
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["admin_account"]
receivingAccount = suite.testAccounts["local_account_2"]
streams = suite.openStreams(ctx,
@@ -2156,7 +2156,7 @@ func (suite *FromClientAPITestSuite) TestProcessUpdateStatusInteractedWith() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
postingAccount = suite.testAccounts["local_account_1"]
receivingAccount = suite.testAccounts["admin_account"]
streams = suite.openStreams(ctx,
@@ -2244,7 +2244,7 @@ func (suite *FromClientAPITestSuite) TestProcessStatusDelete() {
defer testrig.TearDownTestStructs(testStructs)
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
deletingAccount = suite.testAccounts["local_account_1"]
receivingAccount = suite.testAccounts["local_account_2"]
deletedStatus = suite.testStatuses["local_account_1_status_1"]
diff --git a/internal/processing/workers/fromfediapi_test.go b/internal/processing/workers/fromfediapi_test.go
index d197f4122..7811e9f3d 100644
--- a/internal/processing/workers/fromfediapi_test.go
+++ b/internal/processing/workers/fromfediapi_test.go
@@ -62,7 +62,7 @@ func (suite *FromFediAPITestSuite) TestProcessFederationAnnounce() {
announceStatus.Account = boostingAccount
announceStatus.Visibility = boostedStatus.Visibility
- err := testStructs.Processor.Workers().ProcessFromFediAPI(context.Background(), &messages.FromFediAPI{
+ err := testStructs.Processor.Workers().ProcessFromFediAPI(suite.T().Context(), &messages.FromFediAPI{
APObjectType: ap.ActivityAnnounce,
APActivityType: ap.ActivityCreate,
GTSModel: announceStatus,
@@ -81,7 +81,7 @@ func (suite *FromFediAPITestSuite) TestProcessFederationAnnounce() {
}
_, err = testStructs.State.DB.GetStatusByID(
- context.Background(),
+ suite.T().Context(),
announceStatus.ID,
)
return err == nil
@@ -97,7 +97,7 @@ func (suite *FromFediAPITestSuite) TestProcessFederationAnnounce() {
},
}
notif := &gtsmodel.Notification{}
- err = testStructs.State.DB.GetWhere(context.Background(), where, notif)
+ err = testStructs.State.DB.GetWhere(suite.T().Context(), where, notif)
suite.NoError(err)
suite.Equal(gtsmodel.NotificationReblog, notif.NotificationType)
suite.Equal(boostedStatus.AccountID, notif.TargetAccountID)
@@ -125,7 +125,7 @@ func (suite *FromFediAPITestSuite) TestProcessReplyMention() {
replyingAccount.FetchedAt = time.Now()
replyingAccount.SuspendedAt = time.Time{}
replyingAccount.SuspensionOrigin = ""
- err := testStructs.State.DB.UpdateAccount(context.Background(),
+ err := testStructs.State.DB.UpdateAccount(suite.T().Context(),
replyingAccount,
"fetched_at",
"suspended_at",
@@ -139,11 +139,11 @@ func (suite *FromFediAPITestSuite) TestProcessReplyMention() {
ap.AppendInReplyTo(replyingStatusable, testrig.URLMustParse(repliedStatus.URI))
// Open a websocket stream to later test the streamed status reply.
- wssStream, errWithCode := testStructs.Processor.Stream().Open(context.Background(), repliedAccount, stream.TimelineHome)
+ wssStream, errWithCode := testStructs.Processor.Stream().Open(suite.T().Context(), repliedAccount, stream.TimelineHome)
suite.NoError(errWithCode)
// Send the replied status off to the fedi worker to be further processed.
- err = testStructs.Processor.Workers().ProcessFromFediAPI(context.Background(), &messages.FromFediAPI{
+ err = testStructs.Processor.Workers().ProcessFromFediAPI(suite.T().Context(), &messages.FromFediAPI{
APObjectType: ap.ObjectNote,
APActivityType: ap.ActivityCreate,
APObject: replyingStatusable,
@@ -158,7 +158,7 @@ func (suite *FromFediAPITestSuite) TestProcessReplyMention() {
// 1. status should be in the database
var replyingStatus *gtsmodel.Status
if !testrig.WaitFor(func() bool {
- replyingStatus, err = testStructs.State.DB.GetStatusByURI(context.Background(), replyingURI)
+ replyingStatus, err = testStructs.State.DB.GetStatusByURI(suite.T().Context(), replyingURI)
return err == nil
}) {
suite.FailNow("timed out waiting for replying status to be in the database")
@@ -166,7 +166,7 @@ func (suite *FromFediAPITestSuite) TestProcessReplyMention() {
// 2. a notification should exist for the mention
var notif gtsmodel.Notification
- err = testStructs.State.DB.GetWhere(context.Background(), []db.Where{
+ err = testStructs.State.DB.GetWhere(suite.T().Context(), []db.Where{
{Key: "status_id", Value: replyingStatus.ID},
}, &notif)
suite.NoError(err)
@@ -176,7 +176,7 @@ func (suite *FromFediAPITestSuite) TestProcessReplyMention() {
suite.Equal(replyingStatus.ID, notif.StatusOrEditID)
suite.False(*notif.Read)
- ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
+ ctx, _ := context.WithTimeout(suite.T().Context(), time.Second*5)
msg, ok := wssStream.Recv(ctx)
suite.True(ok)
@@ -198,7 +198,7 @@ func (suite *FromFediAPITestSuite) TestProcessFave() {
favedStatus := suite.testStatuses["local_account_1_status_1"]
favingAccount := suite.testAccounts["remote_account_1"]
- wssStream, errWithCode := testStructs.Processor.Stream().Open(context.Background(), favedAccount, stream.TimelineNotifications)
+ wssStream, errWithCode := testStructs.Processor.Stream().Open(suite.T().Context(), favedAccount, stream.TimelineNotifications)
suite.NoError(errWithCode)
fave := &gtsmodel.StatusFave{
@@ -214,10 +214,10 @@ func (suite *FromFediAPITestSuite) TestProcessFave() {
URI: favingAccount.URI + "/faves/aaaaaaaaaaaa",
}
- err := testStructs.State.DB.Put(context.Background(), fave)
+ err := testStructs.State.DB.Put(suite.T().Context(), fave)
suite.NoError(err)
- err = testStructs.Processor.Workers().ProcessFromFediAPI(context.Background(), &messages.FromFediAPI{
+ err = testStructs.Processor.Workers().ProcessFromFediAPI(suite.T().Context(), &messages.FromFediAPI{
APObjectType: ap.ActivityLike,
APActivityType: ap.ActivityCreate,
GTSModel: fave,
@@ -240,7 +240,7 @@ func (suite *FromFediAPITestSuite) TestProcessFave() {
}
notif := &gtsmodel.Notification{}
- err = testStructs.State.DB.GetWhere(context.Background(), where, notif)
+ err = testStructs.State.DB.GetWhere(suite.T().Context(), where, notif)
suite.NoError(err)
suite.Equal(gtsmodel.NotificationFavourite, notif.NotificationType)
suite.Equal(fave.TargetAccountID, notif.TargetAccountID)
@@ -248,7 +248,7 @@ func (suite *FromFediAPITestSuite) TestProcessFave() {
suite.Equal(fave.StatusID, notif.StatusOrEditID)
suite.False(*notif.Read)
- ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
+ ctx, _ := context.WithTimeout(suite.T().Context(), time.Second*5)
msg, ok := wssStream.Recv(ctx)
suite.True(ok)
@@ -271,7 +271,7 @@ func (suite *FromFediAPITestSuite) TestProcessFaveWithDifferentReceivingAccount(
favedStatus := suite.testStatuses["local_account_1_status_1"]
favingAccount := suite.testAccounts["remote_account_1"]
- wssStream, errWithCode := testStructs.Processor.Stream().Open(context.Background(), receivingAccount, stream.TimelineHome)
+ wssStream, errWithCode := testStructs.Processor.Stream().Open(suite.T().Context(), receivingAccount, stream.TimelineHome)
suite.NoError(errWithCode)
fave := &gtsmodel.StatusFave{
@@ -287,10 +287,10 @@ func (suite *FromFediAPITestSuite) TestProcessFaveWithDifferentReceivingAccount(
URI: favingAccount.URI + "/faves/aaaaaaaaaaaa",
}
- err := testStructs.State.DB.Put(context.Background(), fave)
+ err := testStructs.State.DB.Put(suite.T().Context(), fave)
suite.NoError(err)
- err = testStructs.Processor.Workers().ProcessFromFediAPI(context.Background(), &messages.FromFediAPI{
+ err = testStructs.Processor.Workers().ProcessFromFediAPI(suite.T().Context(), &messages.FromFediAPI{
APObjectType: ap.ActivityLike,
APActivityType: ap.ActivityCreate,
GTSModel: fave,
@@ -313,7 +313,7 @@ func (suite *FromFediAPITestSuite) TestProcessFaveWithDifferentReceivingAccount(
}
notif := &gtsmodel.Notification{}
- err = testStructs.State.DB.GetWhere(context.Background(), where, notif)
+ err = testStructs.State.DB.GetWhere(suite.T().Context(), where, notif)
suite.NoError(err)
suite.Equal(gtsmodel.NotificationFavourite, notif.NotificationType)
suite.Equal(fave.TargetAccountID, notif.TargetAccountID)
@@ -322,7 +322,7 @@ func (suite *FromFediAPITestSuite) TestProcessFaveWithDifferentReceivingAccount(
suite.False(*notif.Read)
// 2. no notification should be streamed to the account that received the fave message, because they weren't the target
- ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
+ ctx, _ := context.WithTimeout(suite.T().Context(), time.Second*5)
_, ok := wssStream.Recv(ctx)
suite.False(ok)
}
@@ -331,7 +331,7 @@ func (suite *FromFediAPITestSuite) TestProcessAccountDelete() {
testStructs := testrig.SetupTestStructs(rMediaPath, rTemplatePath)
defer testrig.TearDownTestStructs(testStructs)
- ctx := context.Background()
+ ctx := suite.T().Context()
deletedAccount := &gtsmodel.Account{}
*deletedAccount = *suite.testAccounts["remote_account_1"]
@@ -425,14 +425,14 @@ func (suite *FromFediAPITestSuite) TestProcessFollowRequestLocked() {
testStructs := testrig.SetupTestStructs(rMediaPath, rTemplatePath)
defer testrig.TearDownTestStructs(testStructs)
- ctx := context.Background()
+ ctx := suite.T().Context()
originAccount := suite.testAccounts["remote_account_1"]
// target is a locked account
targetAccount := suite.testAccounts["local_account_2"]
- wssStream, errWithCode := testStructs.Processor.Stream().Open(context.Background(), targetAccount, stream.TimelineHome)
+ wssStream, errWithCode := testStructs.Processor.Stream().Open(suite.T().Context(), targetAccount, stream.TimelineHome)
suite.NoError(errWithCode)
// put the follow request in the database as though it had passed through the federating db already
@@ -462,7 +462,7 @@ func (suite *FromFediAPITestSuite) TestProcessFollowRequestLocked() {
suite.NoError(err)
ctx, _ = context.WithTimeout(ctx, time.Second*5)
- msg, ok := wssStream.Recv(context.Background())
+ msg, ok := wssStream.Recv(suite.T().Context())
suite.True(ok)
suite.Equal(stream.EventTypeNotification, msg.Event)
@@ -482,14 +482,14 @@ func (suite *FromFediAPITestSuite) TestProcessFollowRequestUnlocked() {
testStructs := testrig.SetupTestStructs(rMediaPath, rTemplatePath)
defer testrig.TearDownTestStructs(testStructs)
- ctx := context.Background()
+ ctx := suite.T().Context()
originAccount := suite.testAccounts["remote_account_1"]
// target is an unlocked account
targetAccount := suite.testAccounts["local_account_1"]
- wssStream, errWithCode := testStructs.Processor.Stream().Open(context.Background(), targetAccount, stream.TimelineHome)
+ wssStream, errWithCode := testStructs.Processor.Stream().Open(suite.T().Context(), targetAccount, stream.TimelineHome)
suite.NoError(errWithCode)
// put the follow request in the database as though it had passed through the federating db already
@@ -565,7 +565,7 @@ func (suite *FromFediAPITestSuite) TestProcessFollowRequestUnlocked() {
suite.Equal("Accept", accept.Type)
ctx, _ = context.WithTimeout(ctx, time.Second*5)
- msg, ok := wssStream.Recv(context.Background())
+ msg, ok := wssStream.Recv(suite.T().Context())
suite.True(ok)
suite.Equal(stream.EventTypeNotification, msg.Event)
@@ -583,7 +583,7 @@ func (suite *FromFediAPITestSuite) TestCreateStatusFromIRI() {
testStructs := testrig.SetupTestStructs(rMediaPath, rTemplatePath)
defer testrig.TearDownTestStructs(testStructs)
- ctx := context.Background()
+ ctx := suite.T().Context()
receivingAccount := suite.testAccounts["local_account_1"]
statusCreator := suite.testAccounts["remote_account_2"]
@@ -599,7 +599,7 @@ func (suite *FromFediAPITestSuite) TestCreateStatusFromIRI() {
suite.NoError(err)
// status should now be in the database, attributed to remote_account_2
- s, err := testStructs.State.DB.GetStatusByURI(context.Background(), "http://example.org/users/Some_User/statuses/afaba698-5740-4e32-a702-af61aa543bc1")
+ s, err := testStructs.State.DB.GetStatusByURI(suite.T().Context(), "http://example.org/users/Some_User/statuses/afaba698-5740-4e32-a702-af61aa543bc1")
suite.NoError(err)
suite.Equal(statusCreator.URI, s.AccountURI)
}
@@ -609,7 +609,7 @@ func (suite *FromFediAPITestSuite) TestMoveAccount() {
defer testrig.TearDownTestStructs(testStructs)
// We're gonna migrate foss_satan to our local admin account.
- ctx := context.Background()
+ ctx := suite.T().Context()
receivingAcct := suite.testAccounts["local_account_1"]
// Copy requesting and target accounts
@@ -683,7 +683,7 @@ func (suite *FromFediAPITestSuite) TestMoveAccount() {
func (suite *FromFediAPITestSuite) TestUndoAnnounce() {
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
testStructs = testrig.SetupTestStructs(rMediaPath, rTemplatePath)
requestingAcct = suite.testAccounts["remote_account_1"]
receivingAcct = suite.testAccounts["local_account_1"]
@@ -737,7 +737,7 @@ func (suite *FromFediAPITestSuite) TestUndoAnnounce() {
func (suite *FromFediAPITestSuite) TestUpdateNote() {
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
testStructs = testrig.SetupTestStructs(rMediaPath, rTemplatePath)
requestingAcct = suite.testAccounts["remote_account_2"]
receivingAcct = suite.testAccounts["local_account_1"]
diff --git a/internal/processing/workers/surfacenotify_test.go b/internal/processing/workers/surfacenotify_test.go
index 7acea2436..459b3e125 100644
--- a/internal/processing/workers/surfacenotify_test.go
+++ b/internal/processing/workers/surfacenotify_test.go
@@ -18,7 +18,6 @@
package workers_test
import (
- "context"
"sync"
"testing"
"time"
@@ -50,7 +49,7 @@ func (suite *SurfaceNotifyTestSuite) TestSpamNotifs() {
}
var (
- ctx = context.Background()
+ ctx = suite.T().Context()
notificationType = gtsmodel.NotificationFollow
targetAccount = suite.testAccounts["local_account_1"]
originAccount = suite.testAccounts["local_account_2"]