mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 09:37:28 -06:00
[chore] Test fixes (#788)
* use 'test' value for testrig storage backend * update test dependency * add WaitFor func in testrig * use WaitFor function instead of time.Sleep * tidy up tests * make SentMessages a sync.map * go fmt
This commit is contained in:
parent
bee8458a2d
commit
0245c606d7
30 changed files with 501 additions and 222 deletions
|
|
@ -20,13 +20,12 @@ package dereferencing_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/media"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
type AttachmentTestSuite struct {
|
||||
|
|
@ -128,12 +127,11 @@ func (suite *AttachmentTestSuite) TestDereferenceAttachmentAsync() {
|
|||
suite.NoError(err)
|
||||
attachmentID := processingMedia.AttachmentID()
|
||||
|
||||
// wait for the media to finish processing
|
||||
for finished := processingMedia.Finished(); !finished; finished = processingMedia.Finished() {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
fmt.Printf("\n\nnot finished yet...\n\n")
|
||||
if !testrig.WaitFor(func() bool {
|
||||
return processingMedia.Finished()
|
||||
}) {
|
||||
suite.FailNow("timed out waiting for media to be processed")
|
||||
}
|
||||
fmt.Printf("\n\nfinished!\n\n")
|
||||
|
||||
// now get the attachment from the database
|
||||
attachment, err := suite.db.GetAttachmentByID(ctx, attachmentID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue