From afa5e5bc0e062dc8e7966d25f5dcf1a0e4935969 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 1 Oct 2025 12:22:01 -0300 Subject: [PATCH] khatru: fix test for expiration manager, skip it unless code is manually adjusted for the test. --- khatru/relay_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/khatru/relay_test.go b/khatru/relay_test.go index 169e70b..9a60bf0 100644 --- a/khatru/relay_test.go +++ b/khatru/relay_test.go @@ -236,11 +236,17 @@ func TestBasicRelayFunctionality(t *testing.T) { // create a new relay with shorter expiration check interval relay := NewRelay() - relay.expirationManager.interval = 3 * time.Second // check every 3 seconds store := &slicestore.SliceStore{} store.Init() + + // this will automatically start the expiration manager relay.UseEventstore(store, 400) + if relay.expirationManager.interval > time.Second*10 { + t.Skip("expiration manager must be manually hardcodedly set to less than 10s for testing") + return + } + // start test server server := httptest.NewServer(relay) defer server.Close() @@ -280,8 +286,8 @@ func TestBasicRelayFunctionality(t *testing.T) { } sub.Unsub() - // wait for expiration check (>3 seconds) - time.Sleep(4 * time.Second) + // wait for expiration check (+1 second) + time.Sleep(relay.expirationManager.interval + time.Second) // verify event no longer exists sub, err = client.Subscribe(ctx, nostr.Filter{