From 9cb9fda65b96cf851f47a3fb6ec57b8d51b710cd Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sat, 7 Dec 2024 03:32:51 +0200 Subject: Silent curl, holy curl --- api/tests/announce_zblock.sh | 6 +++--- api/tests/announce_zchain_link.sh | 8 ++++---- api/tests/default_route.sh | 2 +- api/tests/gathered_zblocks.sh | 4 ++-- api/tests/gathered_zchain_zlatest_pairs.sh | 2 +- api/tests/latest_known_mined_block.sh | 2 +- api/tests/node_local_chain.sh | 2 +- api/tests/node_local_zlatest.sh | 2 +- api/tests/show_mined_block.sh | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) (limited to 'api/tests') diff --git a/api/tests/announce_zblock.sh b/api/tests/announce_zblock.sh index 11572c0..15a48ef 100755 --- a/api/tests/announce_zblock.sh +++ b/api/tests/announce_zblock.sh @@ -3,7 +3,7 @@ PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" printf "TEST\t/v0/announce/zblock\n" printf "\t01:\tendpoint with valid data" -curl http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$(ak zchain --get-latest)'"}' 2>/dev/null | jq -M -c > /dev/null +curl -s http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$(ak zchain --get-latest)'"}' 2>/dev/null | jq -M -c > /dev/null if [ $? -eq 0 ] then printf "\t\t\033[0;32mPASSED\033[0;0m" @@ -13,7 +13,7 @@ fi printf "\n" printf "\t02:\tendpoint with invalid data" -curl http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$(ak zchain --get-latest)'sdfas"}' 2>/dev/null | jq -M -c > /dev/null +curl -s http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":"'$(ak zchain --get-latest)'sdfas"}' 2>/dev/null | jq -M -c > /dev/null if [ $? -eq 0 ] then printf "\t\t\033[0;32mPASSED\033[0;0m" @@ -23,7 +23,7 @@ fi printf "\n" printf "\t03:\tendpoint no data" -curl http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":""}' 2>/dev/null | jq -M -c > /dev/null +curl -s http://127.0.0.1:8610/v0/announce/zblock --header 'Content-Type: application/json' --data-raw '{"zblock":""}' 2>/dev/null | jq -M -c > /dev/null if [ $? -eq 0 ] then printf "\t\t\t\033[0;32mPASSED\033[0;0m" diff --git a/api/tests/announce_zchain_link.sh b/api/tests/announce_zchain_link.sh index c92a367..1608a08 100755 --- a/api/tests/announce_zchain_link.sh +++ b/api/tests/announce_zchain_link.sh @@ -2,9 +2,9 @@ PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" printf "TEST\t/v0/announce/zchain\n" -# curl http://127.0.0.1:8610/v0/announce/zchain +# curl -s http://127.0.0.1:8610/v0/announce/zchain printf "\t01:\tendpoint with valid data" -curl -POST http://localhost:8610/v0/announce/zchain --header 'Content-Type: application/json' --data-raw '{"zchain":"k51qzi5uqu5dgapvk7bhxmchuqya9immqdpbz0f1r91ckpdqzub63afn3d5apr"}' 2>/dev/null | jq -M -c > /dev/null +curl -s -POST http://localhost:8610/v0/announce/zchain --header 'Content-Type: application/json' --data-raw '{"zchain":"k51qzi5uqu5dgapvk7bhxmchuqya9immqdpbz0f1r91ckpdqzub63afn3d5apr"}' 2>/dev/null | jq -M -c > /dev/null if [ $? -eq 0 ] then printf "\t\t\033[0;32mPASSED\033[0;0m" @@ -14,7 +14,7 @@ fi printf "\n" printf "\t02:\tendpoint with invalid data" -curl -POST http://localhost:8610/v0/announce/zchain --header 'Content-Type: application/json' --data-raw '{"zchain":"k51qzi5uqu5dgapvk7bhxmchuqya9immqdpbz0f1r91ckpdqzub63afn3d5aar"}' 2>/dev/null | jq -M -c > /dev/null +curl -s -POST http://localhost:8610/v0/announce/zchain --header 'Content-Type: application/json' --data-raw '{"zchain":"k51qzi5uqu5dgapvk7bhxmchuqya9immqdpbz0f1r91ckpdqzub63afn3d5aar"}' 2>/dev/null | jq -M -c > /dev/null if [ $? -eq 0 ] then printf "\t\t\033[0;32mPASSED\033[0;0m" @@ -24,7 +24,7 @@ fi printf "\n" printf "\t03:\tendpoint no data" -curl -POST http://localhost:8610/v0/announce/zchain --header 'Content-Type: application/json' --data-raw '{"zchain":""}' 2>/dev/null | jq -M -c > /dev/null +curl -s -POST http://localhost:8610/v0/announce/zchain --header 'Content-Type: application/json' --data-raw '{"zchain":""}' 2>/dev/null | jq -M -c > /dev/null if [ $? -eq 0 ] then printf "\t\t\t\033[0;32mPASSED\033[0;0m" diff --git a/api/tests/default_route.sh b/api/tests/default_route.sh index 950ce32..c50d11d 100755 --- a/api/tests/default_route.sh +++ b/api/tests/default_route.sh @@ -1,7 +1,7 @@ #!/bin/bash PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" -curl http://127.0.0.1:8610 2>/dev/null | jq > /dev/null +curl -s http://127.0.0.1:8610 2>/dev/null | jq > /dev/null if [ $? -eq 0 ] then printf "\t\t\033[0;32mPASSED\033[0;0m" diff --git a/api/tests/gathered_zblocks.sh b/api/tests/gathered_zblocks.sh index 3e38ccc..bde7313 100755 --- a/api/tests/gathered_zblocks.sh +++ b/api/tests/gathered_zblocks.sh @@ -5,7 +5,7 @@ PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" printf "TEST\t/see\n" printf "\t01:\tOutput is valid JSON format..." -curl http://127.0.0.1:8610/v0/see 2>/dev/null | jq > /dev/null +curl -s http://127.0.0.1:8610/v0/see 2>/dev/null | jq > /dev/null if [ $? -eq 0 ] then printf "\t\t\033[0;32mPASSED\033[0;0m" @@ -15,7 +15,7 @@ fi printf "\n" printf "\t02:\tFound blocks inside response..." -curl http://127.0.0.1:8610/v0/see 2>/dev/null | grep block > /dev/null +curl -s http://127.0.0.1:8610/v0/see 2>/dev/null | grep block > /dev/null if [ $? -eq 0 ] then printf "\t\t\033[0;32mPASSED\033[0;0m" diff --git a/api/tests/gathered_zchain_zlatest_pairs.sh b/api/tests/gathered_zchain_zlatest_pairs.sh index 361cc33..60da911 100755 --- a/api/tests/gathered_zchain_zlatest_pairs.sh +++ b/api/tests/gathered_zchain_zlatest_pairs.sh @@ -3,7 +3,7 @@ PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" printf "TEST\t/seens\n" printf "\t01:\tendpoint returns JSON..." -curl http://127.0.0.1:8610/v0/seens 2>/dev/null | jq > /dev/null +curl -s http://127.0.0.1:8610/v0/seens 2>/dev/null | jq > /dev/null if [ $? -eq 0 ] then printf '\t\t\033[0;32mPASSED\033[0;0m\n' diff --git a/api/tests/latest_known_mined_block.sh b/api/tests/latest_known_mined_block.sh index 64ff612..168767e 100755 --- a/api/tests/latest_known_mined_block.sh +++ b/api/tests/latest_known_mined_block.sh @@ -4,7 +4,7 @@ PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" printf "TEST\t/slatest\n" printf "\t01:\tendpoint" -A="$(curl http://127.0.0.1:8610/v0/slatest 2>/dev/null)" +A="$(curl -s http://127.0.0.1:8610/v0/slatest 2>/dev/null)" B="$(ak schain --get-latest)" if [ "$A" == "$B" ] then diff --git a/api/tests/node_local_chain.sh b/api/tests/node_local_chain.sh index d1b87b4..fb5672f 100755 --- a/api/tests/node_local_chain.sh +++ b/api/tests/node_local_chain.sh @@ -3,7 +3,7 @@ PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" printf "TEST /zchain\n" printf "\t01:\tComparing API with CLI response..." -API_RESPONSE="$(curl http://127.0.0.1:8610/v0/zchain 2>/dev/null | jq -c -M | sha512sum - | awk '{print $1 }')" +API_RESPONSE="$(curl -s http://127.0.0.1:8610/v0/zchain 2>/dev/null | jq -c -M | sha512sum - | awk '{print $1 }')" CMD_RESPONSE="$(ak zchain --crawl | jq -c -M | sha512sum - | awk '{ print $1 }')" if [ "$API_RESPONSE" == "$CMD_RESPONSE" ] then diff --git a/api/tests/node_local_zlatest.sh b/api/tests/node_local_zlatest.sh index aaf2681..132107f 100755 --- a/api/tests/node_local_zlatest.sh +++ b/api/tests/node_local_zlatest.sh @@ -1,7 +1,7 @@ #!/bin/bash PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" -API_RES="$(curl http://127.0.0.1:8610/v0/zlatest 2>/dev/null | sha512sum - | awk '{ printf $1 }')" +API_RES="$(curl -s http://127.0.0.1:8610/v0/zlatest 2>/dev/null | sha512sum - | awk '{ printf $1 }')" CMD_RES="$(ak zchain --get-latest | sed -e 's/^/{"zlatest":"/; s/$/"}/' | sha512sum - | awk '{ printf $1 }')" printf "TEST /zlatest\n" printf "\t01:\tLatest is the same between API response and CLI..." diff --git a/api/tests/show_mined_block.sh b/api/tests/show_mined_block.sh index 51847d7..6477a32 100755 --- a/api/tests/show_mined_block.sh +++ b/api/tests/show_mined_block.sh @@ -2,4 +2,4 @@ PROGRAM="$(basename $0)" printf '[%s]\n' "$PROGRAM" printf "#TODO /sblock endpoint\n" -# curl http://127.0.0.1:8610/v0/sblock +# curl -s http://127.0.0.1:8610/v0/sblock -- cgit v1.2.3