Skip to content

Commit

Permalink
test: add some more logging to diagnose e2e test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPiechota committed Jan 21, 2025
1 parent a5f99ee commit 5611fef
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
23 changes: 15 additions & 8 deletions apps/arweave/e2e/ar_e2e.erl
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,21 @@ assert_block({replica_2_9, Address}, MinedBlock) ->


assert_syncs_range(Node, StartOffset, EndOffset) ->
?assert(
ar_util:do_until(
fun() -> has_range(Node, StartOffset, EndOffset) end,
100,
60_000
),
iolist_to_binary(io_lib:format(
"~s Failed to sync range ~p - ~p", [Node, StartOffset, EndOffset]))).
HasRange = ar_util:do_until(
fun() -> has_range(Node, StartOffset, EndOffset) end,
100,
60_000
),
case HasRange of
true ->
ok;
false ->
SyncRecord = ar_http_iface_client:get_sync_record(Node, json),
?assert(false,
iolist_to_binary(io_lib:format(
"~s failed to sync range ~p - ~p. Sync record: ~p",
[Node, StartOffset, EndOffset, SyncRecord])))
end.

assert_does_not_sync_range(Node, StartOffset, EndOffset) ->
ar_util:do_until(
Expand Down
4 changes: 4 additions & 0 deletions apps/arweave/e2e/ar_repack_mine_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ repack_mine_test_() ->
%% --------------------------------------------------------------------------------------------
test_repack_mine({FromPackingType, ToPackingType}) ->
ar_e2e:delayed_print(<<" ~p -> ~p ">>, [FromPackingType, ToPackingType]),
?LOG_INFO([{event, test_repack_mine}, {module, ?MODULE},
{from_packing_type, FromPackingType}, {to_packing_type, ToPackingType}]),
ValidatorNode = peer1,
RepackerNode = peer2,
{Blocks, _AddrA, Chunks} = ar_e2e:start_source_node(
Expand Down Expand Up @@ -85,6 +87,8 @@ test_repack_mine({FromPackingType, ToPackingType}) ->

test_repacking_blocked({FromPackingType, ToPackingType}) ->
ar_e2e:delayed_print(<<" ~p -> ~p ">>, [FromPackingType, ToPackingType]),
?LOG_INFO([{event, test_repacking_blocked}, {module, ?MODULE},
{from_packing_type, FromPackingType}, {to_packing_type, ToPackingType}]),
ValidatorNode = peer1,
RepackerNode = peer2,
{Blocks, _AddrA, Chunks} = ar_e2e:start_source_node(
Expand Down
14 changes: 11 additions & 3 deletions apps/arweave/src/ar_http_iface_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
get_block/3, get_tx/2, get_txs/2, get_tx_from_remote_peer/2,
get_tx_data/2, get_wallet_list_chunk/2, get_wallet_list_chunk/3,
get_wallet_list/2, add_peer/1, get_info/1, get_info/2, get_peers/1,
get_time/2, get_height/1, get_block_index/3, get_sync_record/1,
get_sync_record/3, get_chunk_binary/3, get_mempool/1,
get_time/2, get_height/1, get_block_index/3,
get_sync_record/1, get_sync_record/2, get_sync_record/3,
get_chunk_binary/3, get_mempool/1,
get_sync_buckets/1, get_recent_hash_list/1,
get_recent_hash_list_diff/2, get_reward_history/3,
get_block_time_history/3, push_nonce_limiter_update/3,
Expand Down Expand Up @@ -360,7 +361,14 @@ decode_block_index(Bin, json) ->
end.

get_sync_record(Peer) ->
Headers = [{<<"Content-Type">>, <<"application/etf">>}],
get_sync_record(Peer, binary).

get_sync_record(Peer, Encoding) ->
ContentType = case Encoding of
binary -> <<"application/etf">>;
json -> <<"application/json">>
end,
Headers = [{<<"Content-Type">>, ContentType}],
handle_sync_record_response(ar_http:req(#{
peer => Peer,
method => get,
Expand Down

0 comments on commit 5611fef

Please sign in to comment.