mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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>
This commit is contained in:
@@ -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(),
|
||||
|
@@ -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
|
||||
|
@@ -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"]
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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."
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user