summaryrefslogtreecommitdiff
path: root/internal/timeline/index_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-11-22 19:38:10 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-22 18:38:10 +0000
commit50dc179d332af4a3dc0e69e2c4e39bbbccd3fec5 (patch)
treeb48421907353aa6530a76f8c345e3bc11aeab4c9 /internal/timeline/index_test.go
parent[docs] Document http/s/socks5 proxy use (#1118) (diff)
downloadgotosocial-50dc179d332af4a3dc0e69e2c4e39bbbccd3fec5.tar.xz
[feature] Prune timelines once per hour to plug memory leak (#1117)
* export highest/lowest ULIDs as proper const * add stop + start to timeline manager, other small fixes * unexport unused interface funcs + tidy up * add LastGot func * add timeline Prune function * test prune * update lastGot
Diffstat (limited to 'internal/timeline/index_test.go')
-rw-r--r--internal/timeline/index_test.go68
1 files changed, 0 insertions, 68 deletions
diff --git a/internal/timeline/index_test.go b/internal/timeline/index_test.go
index c89c85a09..5571bfb05 100644
--- a/internal/timeline/index_test.go
+++ b/internal/timeline/index_test.go
@@ -69,63 +69,6 @@ func (suite *IndexTestSuite) TearDownTest() {
testrig.StandardDBTeardown(suite.db)
}
-func (suite *IndexTestSuite) TestIndexBeforeLowID() {
- // index 10 before the lowest status ID possible
- err := suite.timeline.IndexBefore(context.Background(), "00000000000000000000000000", 10)
- suite.NoError(err)
-
- postID, err := suite.timeline.OldestIndexedItemID(context.Background())
- suite.NoError(err)
- suite.Equal("01F8MHBQCBTDKN6X5VHGMMN4MA", postID)
-
- indexLength := suite.timeline.ItemIndexLength(context.Background())
- suite.Equal(10, indexLength)
-}
-
-func (suite *IndexTestSuite) TestIndexBeforeHighID() {
- // index 10 before the highest status ID possible
- err := suite.timeline.IndexBefore(context.Background(), "ZZZZZZZZZZZZZZZZZZZZZZZZZZ", 10)
- suite.NoError(err)
-
- // the oldest indexed post should be empty
- postID, err := suite.timeline.OldestIndexedItemID(context.Background())
- suite.NoError(err)
- suite.Empty(postID)
-
- // indexLength should be 0
- indexLength := suite.timeline.ItemIndexLength(context.Background())
- suite.Equal(0, indexLength)
-}
-
-func (suite *IndexTestSuite) TestIndexBehindHighID() {
- // index 10 behind the highest status ID possible
- err := suite.timeline.IndexBehind(context.Background(), "ZZZZZZZZZZZZZZZZZZZZZZZZZZ", 10)
- suite.NoError(err)
-
- // the newest indexed post should be the highest one we have in our testrig
- postID, err := suite.timeline.NewestIndexedItemID(context.Background())
- suite.NoError(err)
- suite.Equal("01G36SF3V6Y6V5BF9P4R7PQG7G", postID)
-
- indexLength := suite.timeline.ItemIndexLength(context.Background())
- suite.Equal(10, indexLength)
-}
-
-func (suite *IndexTestSuite) TestIndexBehindLowID() {
- // index 10 behind the lowest status ID possible
- err := suite.timeline.IndexBehind(context.Background(), "00000000000000000000000000", 10)
- suite.NoError(err)
-
- // the newest indexed post should be empty
- postID, err := suite.timeline.NewestIndexedItemID(context.Background())
- suite.NoError(err)
- suite.Empty(postID)
-
- // indexLength should be 0
- indexLength := suite.timeline.ItemIndexLength(context.Background())
- suite.Equal(0, indexLength)
-}
-
func (suite *IndexTestSuite) TestOldestIndexedItemIDEmpty() {
// the oldest indexed post should be an empty string since there's nothing indexed yet
postID, err := suite.timeline.OldestIndexedItemID(context.Background())
@@ -137,17 +80,6 @@ func (suite *IndexTestSuite) TestOldestIndexedItemIDEmpty() {
suite.Equal(0, indexLength)
}
-func (suite *IndexTestSuite) TestNewestIndexedItemIDEmpty() {
- // the newest indexed post should be an empty string since there's nothing indexed yet
- postID, err := suite.timeline.NewestIndexedItemID(context.Background())
- suite.NoError(err)
- suite.Empty(postID)
-
- // indexLength should be 0
- indexLength := suite.timeline.ItemIndexLength(context.Background())
- suite.Equal(0, indexLength)
-}
-
func (suite *IndexTestSuite) TestIndexAlreadyIndexed() {
testStatus := suite.testStatuses["local_account_1_status_1"]