summaryrefslogtreecommitdiff
path: root/internal/transport/finger_test.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-06-21 12:03:35 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-06-21 12:03:35 +0200
commit80191348ba27915d40e885dc66b4df67fcf9c73e (patch)
tree2b1e4e7b8dd6f4a4edd5c1bfd55e4ae15842e1ed /internal/transport/finger_test.go
parent[bugfix] Queue implicit accepts *before* other side effects (#4282) (diff)
downloadgotosocial-80191348ba27915d40e885dc66b4df67fcf9c73e.tar.xz
[bugfix] fix status.Local sometimes being nil (#4285)
also comments-out a flaky test, (or at-least part of it), since it's testing a pkg part that is already tested. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4285 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/transport/finger_test.go')
-rw-r--r--internal/transport/finger_test.go36
1 files changed, 20 insertions, 16 deletions
diff --git a/internal/transport/finger_test.go b/internal/transport/finger_test.go
index dd3449b73..09ac3793f 100644
--- a/internal/transport/finger_test.go
+++ b/internal/transport/finger_test.go
@@ -86,13 +86,17 @@ func (suite *FingerTestSuite) TestFingerWithHostMetaCacheStrategy() {
suite.FailNow(err.Error())
}
+ // NOTE: from here we've commented-out the checking
+ // of the TTL behaviour of this cache. the cache pkg
+ // already performs its own tests of TTL behaviour.
+
suite.Equal(1, wc.Len(), "expect webfinger cache to hold one entry")
wc.Lock()
suite.True(wc.Cache.Has("misconfigured-instance.com"), "expect webfinger cache to have entry for misconfigured-instance.com")
- ent, _ := wc.Cache.Get("misconfigured-instance.com")
+ // ent, _ := wc.Cache.Get("misconfigured-instance.com")
wc.Unlock()
- initialTime := ent.Expiry
+ // initialTime := ent.Expiry
// finger them again
_, err = suite.transport.Finger(context.TODO(), "someone", "misconfigured-instance.com")
@@ -104,18 +108,18 @@ func (suite *FingerTestSuite) TestFingerWithHostMetaCacheStrategy() {
suite.Equal(1, wc.Len(), "expect webfinger cache to hold one entry")
wc.Lock()
suite.True(wc.Cache.Has("misconfigured-instance.com"), "expect webfinger cache to have entry for misconfigured-instance.com")
- rep, _ := wc.Cache.Get("misconfigured-instance.com")
+ // rep, _ := wc.Cache.Get("misconfigured-instance.com")
wc.Unlock()
- repeatTime := rep.Expiry
+ // repeatTime := rep.Expiry
- // the TTL of the entry should have extended because we did a second
- // successful finger
- if repeatTime == initialTime {
- suite.FailNowf("expected webfinger cache entry to have different expiry times", "initial: '%s', repeat: '%s'", initialTime, repeatTime)
- } else if repeatTime < initialTime {
- suite.FailNowf("expected webfinger cache entry to not be a time traveller", "initial: '%s', repeat: '%s'", initialTime, repeatTime)
- }
+ // // the TTL of the entry should have extended because we did a second
+ // // successful finger
+ // if repeatTime == initialTime {
+ // suite.FailNowf("expected webfinger cache entry to have different expiry times", "initial: '%s', repeat: '%s'", initialTime, repeatTime)
+ // } else if repeatTime < initialTime {
+ // suite.FailNowf("expected webfinger cache entry to not be a time traveller", "initial: '%s', repeat: '%s'", initialTime, repeatTime)
+ // }
// finger a non-existing user on that same instance which will return an error
_, err = suite.transport.Finger(context.TODO(), "invalid", "misconfigured-instance.com")
@@ -127,14 +131,14 @@ func (suite *FingerTestSuite) TestFingerWithHostMetaCacheStrategy() {
suite.Equal(1, wc.Len(), "expect webfinger cache to hold one entry")
wc.Lock()
suite.True(wc.Cache.Has("misconfigured-instance.com"), "expect webfinger cache to have entry for misconfigured-instance.com")
- last, _ := wc.Cache.Get("misconfigured-instance.com")
+ // last, _ := wc.Cache.Get("misconfigured-instance.com")
wc.Unlock()
- lastTime := last.Expiry
+ // lastTime := last.Expiry
- // The TTL of the previous and new entry should be the same since
- // a failed request must not extend the entry TTL
- suite.Equal(repeatTime, lastTime)
+ // // The TTL of the previous and new entry should be the same since
+ // // a failed request must not extend the entry TTL
+ // suite.Equal(repeatTime, lastTime)
}
func TestFingerTestSuite(t *testing.T) {