mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
[chore] Fiddle with CI tests; use wasmsqlite3 for CI tests (#2966)
* [chore] Update CI test stuff * don't bother with ldflags * use wasmsqlite3
This commit is contained in:
parent
45fe295caa
commit
9caf29bed2
2 changed files with 67 additions and 24 deletions
43
.drone.yml
43
.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
|
||||
|
||||
...
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue