mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 13:32:26 -06: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:
parent
ec4d4d0115
commit
d5c9c4adc1
175 changed files with 857 additions and 1004 deletions
|
|
@ -18,7 +18,6 @@
|
|||
package bundb_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"code.superseriousbusiness.org/gotosocial/internal/db"
|
||||
|
|
@ -32,7 +31,7 @@ type SearchTestSuite struct {
|
|||
func (suite *SearchTestSuite) TestSearchAccountsTurtleAny() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "turtle", "", "", 10, false, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "turtle", "", "", 10, false, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -41,7 +40,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyWithPrefix() {
|
|||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
// Query will just look for usernames that start with "1happy".
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "@1happy", "", "", 10, false, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "@1happy", "", "", 10, false, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -50,7 +49,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyWithPrefixUpper() {
|
|||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
// Query will just look for usernames that start with "1HAPPY".
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "@1HAPPY", "", "", 10, false, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "@1HAPPY", "", "", 10, false, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -59,7 +58,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyNoPrefix() {
|
|||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
// Query will do the full coalesce.
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "1happy", "", "", 10, false, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "1happy", "", "", 10, false, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -67,7 +66,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyNoPrefix() {
|
|||
func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowing() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "turtle", "", "", 10, true, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "turtle", "", "", 10, true, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -75,7 +74,7 @@ func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowing() {
|
|||
func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowingUpper() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "TURTLE", "", "", 10, true, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "TURTLE", "", "", 10, true, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -83,7 +82,7 @@ func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowingUpper() {
|
|||
func (suite *SearchTestSuite) TestSearchAccountsPostFollowing() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "post", "", "", 10, true, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "post", "", "", 10, true, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -91,7 +90,7 @@ func (suite *SearchTestSuite) TestSearchAccountsPostFollowing() {
|
|||
func (suite *SearchTestSuite) TestSearchAccountsPostAny() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "post", "", "", 10, false, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "post", "", "", 10, false, 0)
|
||||
suite.NoError(err, db.ErrNoEntries)
|
||||
suite.Empty(accounts)
|
||||
}
|
||||
|
|
@ -99,7 +98,7 @@ func (suite *SearchTestSuite) TestSearchAccountsPostAny() {
|
|||
func (suite *SearchTestSuite) TestSearchAccountsFossAny() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "foss", "", "", 10, false, 0)
|
||||
accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "foss", "", "", 10, false, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(accounts, 1)
|
||||
}
|
||||
|
|
@ -107,7 +106,7 @@ func (suite *SearchTestSuite) TestSearchAccountsFossAny() {
|
|||
func (suite *SearchTestSuite) TestSearchStatuses() {
|
||||
testAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
statuses, err := suite.db.SearchForStatuses(context.Background(), testAccount.ID, "hello", "", "", "", 10, 0)
|
||||
statuses, err := suite.db.SearchForStatuses(suite.T().Context(), testAccount.ID, "hello", "", "", "", 10, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(statuses, 1)
|
||||
}
|
||||
|
|
@ -116,7 +115,7 @@ func (suite *SearchTestSuite) TestSearchStatusesFromAccount() {
|
|||
testAccount := suite.testAccounts["local_account_1"]
|
||||
fromAccount := suite.testAccounts["local_account_2"]
|
||||
|
||||
statuses, err := suite.db.SearchForStatuses(context.Background(), testAccount.ID, "hi", fromAccount.ID, "", "", 10, 0)
|
||||
statuses, err := suite.db.SearchForStatuses(suite.T().Context(), testAccount.ID, "hi", fromAccount.ID, "", "", 10, 0)
|
||||
suite.NoError(err)
|
||||
if suite.Len(statuses, 1) {
|
||||
suite.Equal(fromAccount.ID, statuses[0].AccountID)
|
||||
|
|
@ -125,17 +124,17 @@ func (suite *SearchTestSuite) TestSearchStatusesFromAccount() {
|
|||
|
||||
func (suite *SearchTestSuite) TestSearchTags() {
|
||||
// Search with full tag string.
|
||||
tags, err := suite.db.SearchForTags(context.Background(), "welcome", "", "", 10, 0)
|
||||
tags, err := suite.db.SearchForTags(suite.T().Context(), "welcome", "", "", 10, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(tags, 1)
|
||||
|
||||
// Search with partial tag string.
|
||||
tags, err = suite.db.SearchForTags(context.Background(), "wel", "", "", 10, 0)
|
||||
tags, err = suite.db.SearchForTags(suite.T().Context(), "wel", "", "", 10, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(tags, 1)
|
||||
|
||||
// Search with end of tag string.
|
||||
tags, err = suite.db.SearchForTags(context.Background(), "come", "", "", 10, 0)
|
||||
tags, err = suite.db.SearchForTags(suite.T().Context(), "come", "", "", 10, 0)
|
||||
suite.NoError(err)
|
||||
suite.Len(tags, 0)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue