summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.drone.yml43
-rw-r--r--internal/db/bundb/notification_test.go48
2 files changed, 67 insertions, 24 deletions
diff --git a/.drone.yml b/.drone.yml
index 57bf39502..144e21078 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -34,11 +34,20 @@ steps:
path: /root/.cache/go-build
- name: go-src
path: /go
+ environment:
+ CGO_ENABLED: "0"
commands:
- apk update --no-cache && apk add git
- - CGO_ENABLED=0 GTS_DB_TYPE="sqlite" GTS_DB_ADDRESS=":memory:" go test ./...
- - CGO_ENABLED=0 ./test/envparsing.sh
- - CGO_ENABLED=0 ./test/swagger.sh
+ - >-
+ go test
+ -failfast
+ -timeout=20m
+ -tags "wasmsqlite3 netgo osusergo static_build kvformat timetzdata"
+ ./...
+ - ./test/envparsing.sh
+ - ./test/swagger.sh
+ depends_on:
+ - lint
when:
event:
include:
@@ -46,38 +55,40 @@ steps:
- name: web-setup
image: node:18-alpine
- when:
- event:
- include:
- - pull_request
volumes:
- name: yarn_cache
path: /tmp/cache
commands:
- yarn --cwd ./web/source install --frozen-lockfile --cache-folder /tmp/cache
- yarn --cwd ./web/source ts-patch install # https://typia.io/docs/setup/#manual-setup
+ depends_on:
+ - test
+ when:
+ event:
+ include:
+ - pull_request
- name: web-lint
image: node:18-alpine
+ commands:
+ - yarn --cwd ./web/source lint
+ depends_on:
+ - web-setup
when:
event:
include:
- pull_request
- depends_on:
- - web-setup
- commands:
- - yarn --cwd ./web/source lint
- name: web-build
image: node:18-alpine
+ commands:
+ - yarn --cwd ./web/source build
+ depends_on:
+ - web-setup
when:
event:
include:
- pull_request
- depends_on:
- - web-setup
- commands:
- - yarn --cwd ./web/source build
- name: snapshot
image: superseriousbusiness/gotosocial-drone-build:0.6.0 # https://github.com/superseriousbusiness/gotosocial-drone-build
@@ -193,6 +204,6 @@ steps:
---
kind: signature
-hmac: c07f32c63cbb8180c1a37e46ff1362c1c45586819b52c6de67366ae3504314e4
+hmac: 2e74313f4192b3e6daf6d1d00a7c3796019d93da7ce7e0a77208ccc3c37089b0
...
diff --git a/internal/db/bundb/notification_test.go b/internal/db/bundb/notification_test.go
index 83c3ef041..9cc2e4743 100644
--- a/internal/db/bundb/notification_test.go
+++ b/internal/db/bundb/notification_test.go
@@ -20,12 +20,12 @@ package bundb_test
import (
"context"
"errors"
- "fmt"
"testing"
"time"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/db"
+ "github.com/superseriousbusiness/gotosocial/internal/gtscontext"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id"
"github.com/superseriousbusiness/gotosocial/internal/util"
@@ -78,7 +78,7 @@ func (suite *NotificationTestSuite) spamNotifs() {
}
}
- fmt.Printf("\n\n\nput %d notifs in the db\n\n\n", notifCount)
+ suite.T().Logf("put %d notifs in the db\n", notifCount)
}
type NotificationTestSuite struct {
@@ -89,10 +89,18 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithSpam() {
suite.spamNotifs()
testAccount := suite.testAccounts["local_account_1"]
before := time.Now()
- notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil)
+ notifications, err := suite.db.GetAccountNotifications(
+ gtscontext.SetBarebones(context.Background()),
+ testAccount.ID,
+ id.Highest,
+ id.Lowest,
+ "",
+ 20,
+ nil,
+ )
suite.NoError(err)
timeTaken := time.Since(before)
- fmt.Printf("\n\n\n withSpam: got %d notifications in %s\n\n\n", len(notifications), timeTaken)
+ suite.T().Logf("withSpam: got %d notifications in %s\n", len(notifications), timeTaken)
suite.NotNil(notifications)
for _, n := range notifications {
@@ -103,10 +111,18 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithSpam() {
func (suite *NotificationTestSuite) TestGetAccountNotificationsWithoutSpam() {
testAccount := suite.testAccounts["local_account_1"]
before := time.Now()
- notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil)
+ notifications, err := suite.db.GetAccountNotifications(
+ gtscontext.SetBarebones(context.Background()),
+ testAccount.ID,
+ id.Highest,
+ id.Lowest,
+ "",
+ 20,
+ nil,
+ )
suite.NoError(err)
timeTaken := time.Since(before)
- fmt.Printf("\n\n\n withoutSpam: got %d notifications in %s\n\n\n", len(notifications), timeTaken)
+ suite.T().Logf("withoutSpam: got %d notifications in %s\n", len(notifications), timeTaken)
suite.NotNil(notifications)
for _, n := range notifications {
@@ -120,7 +136,15 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithSpam() {
err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "")
suite.NoError(err)
- notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil)
+ notifications, err := suite.db.GetAccountNotifications(
+ gtscontext.SetBarebones(context.Background()),
+ testAccount.ID,
+ id.Highest,
+ id.Lowest,
+ "",
+ 20,
+ nil,
+ )
suite.NoError(err)
suite.Nil(notifications)
suite.Empty(notifications)
@@ -132,7 +156,15 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithTwoAccounts() {
err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "")
suite.NoError(err)
- notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil)
+ notifications, err := suite.db.GetAccountNotifications(
+ gtscontext.SetBarebones(context.Background()),
+ testAccount.ID,
+ id.Highest,
+ id.Lowest,
+ "",
+ 20,
+ nil,
+ )
suite.NoError(err)
suite.Nil(notifications)
suite.Empty(notifications)