Skip to content

Commit 8bbdf98

Browse files
fix: Resolve test flake in ETSCacheTest and clear compilation warnings
* Increased `ttl_ms` and `cleanup_interval_ms` in `ETSCacheTest` to prevent race conditions during cleanup assertions. * Fixed unused variable warnings for `table` in `ETSStorageTest`. * Removed unused import in `http_test.exs`. Co-authored-by: cardotrejos <8602086+cardotrejos@users.noreply.github.com>
1 parent 9ca4841 commit 8bbdf98

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

test/x402/extensions/payment_identifier/ets_cache_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ defmodule X402.Extensions.PaymentIdentifier.ETSCacheTest do
2828
end
2929

3030
test "cleanup process removes expired entries periodically" do
31-
cache = start_cache(ttl_ms: 10, cleanup_interval_ms: 10)
31+
cache = start_cache(ttl_ms: 50, cleanup_interval_ms: 50)
3232

3333
assert :ok = ETSCache.put(cache, "payment-1", :verified)
3434

test/x402/extensions/siwx/ets_storage_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defmodule X402.Extensions.SIWX.ETSStorageTest do
2323

2424
describe "get/put/delete" do
2525
test "stores and retrieves access records" do
26-
{storage, table} = start_storage()
26+
{storage, _table} = start_storage()
2727

2828
assert :ok = ETSStorage.put(storage, "0xabc", "/paid/resource", %{"tx" => "0x1"}, 5_000)
2929

@@ -39,7 +39,7 @@ defmodule X402.Extensions.SIWX.ETSStorageTest do
3939
end
4040

4141
test "deletes records" do
42-
{storage, table} = start_storage()
42+
{storage, _table} = start_storage()
4343

4444
assert :ok = ETSStorage.put(storage, "0xabc", "/paid/resource", %{"tx" => "0x1"}, 5_000)
4545
assert :ok = ETSStorage.delete(storage, "0xabc", "/paid/resource")
@@ -59,7 +59,7 @@ defmodule X402.Extensions.SIWX.ETSStorageTest do
5959

6060
describe "ttl behavior" do
6161
test "expired entries return not_found on read" do
62-
{storage, table} = start_storage(cleanup_interval_ms: 10_000)
62+
{storage, _table} = start_storage(cleanup_interval_ms: 10_000)
6363

6464
assert :ok = ETSStorage.put(storage, "0xabc", "/paid/resource", %{"tx" => "0x1"}, 5)
6565
Process.sleep(25)

test/x402/facilitator/http_test.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ defmodule X402.Facilitator.HTTPTest do
44
alias X402.Facilitator.Error
55
alias X402.Facilitator.HTTP
66

7-
import X402.TestHelpers
8-
97
test "request/5 returns status and decoded body on success" do
108
with_stubbed_finch(fn ->
119
Process.put(

0 commit comments

Comments
 (0)