mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 13:32:26 -06:00
[feature] Media cleanup endpoint (#560)
Adds an admin endpoint to trigger a remote media cleanup. Fixed #348 Signed-off-by: Sashanoraa <sasha@noraa.gay>
This commit is contained in:
parent
545b16ad35
commit
6e947ff266
8 changed files with 321 additions and 5 deletions
|
|
@ -39,7 +39,7 @@ func (suite *PruneRemoteTestSuite) TestPruneRemote() {
|
|||
|
||||
totalPruned, err := suite.manager.PruneRemote(context.Background(), 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(1, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
|
||||
prunedAttachment, err := suite.db.GetAttachmentByID(context.Background(), testAttachment.ID)
|
||||
suite.NoError(err)
|
||||
|
|
@ -51,7 +51,7 @@ func (suite *PruneRemoteTestSuite) TestPruneRemote() {
|
|||
func (suite *PruneRemoteTestSuite) TestPruneRemoteTwice() {
|
||||
totalPruned, err := suite.manager.PruneRemote(context.Background(), 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(1, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
|
||||
// final prune should prune nothing, since the first prune already happened
|
||||
totalPrunedAgain, err := suite.manager.PruneRemote(context.Background(), 1)
|
||||
|
|
@ -65,7 +65,7 @@ func (suite *PruneRemoteTestSuite) TestPruneAndRecache() {
|
|||
|
||||
totalPruned, err := suite.manager.PruneRemote(ctx, 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(1, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
|
||||
// media should no longer be stored
|
||||
_, err = suite.storage.Get(testAttachment.File.Path)
|
||||
|
|
@ -118,7 +118,7 @@ func (suite *PruneRemoteTestSuite) TestPruneOneNonExistent() {
|
|||
// Now attempt to prune remote for item with db entry no file
|
||||
totalPruned, err := suite.manager.PruneRemote(ctx, 1)
|
||||
suite.NoError(err)
|
||||
suite.Equal(1, totalPruned)
|
||||
suite.Equal(2, totalPruned)
|
||||
}
|
||||
|
||||
func TestPruneRemoteTestSuite(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue