summaryrefslogtreecommitdiff
path: root/internal/media/manager_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-08-31 17:31:21 +0200
committerLibravatar GitHub <noreply@github.com>2022-08-31 17:31:21 +0200
commit0245c606d77c8b99833ccc2c0923a298fb482236 (patch)
tree16311e89656894f09cfaeb8b0f21b5ac9e4de502 /internal/media/manager_test.go
parent[feature] add rate limit middleware (#741) (diff)
downloadgotosocial-0245c606d77c8b99833ccc2c0923a298fb482236.tar.xz
[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
Diffstat (limited to 'internal/media/manager_test.go')
-rw-r--r--internal/media/manager_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/media/manager_test.go b/internal/media/manager_test.go
index 396df1523..67f0184bd 100644
--- a/internal/media/manager_test.go
+++ b/internal/media/manager_test.go
@@ -26,7 +26,6 @@ import (
"os"
"path"
"testing"
- "time"
"codeberg.org/gruf/go-store/kv"
"codeberg.org/gruf/go-store/storage"
@@ -34,6 +33,7 @@ import (
gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/media"
gtsstorage "github.com/superseriousbusiness/gotosocial/internal/storage"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
type ManagerTestSuite struct {
@@ -360,11 +360,11 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessAsync() {
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")
// fetch the attachment from the database
attachment, err := suite.db.GetAttachmentByID(ctx, attachmentID)