Skip to content

Commit

Permalink
fix socat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Aug 17, 2023
1 parent b2fb653 commit cb456df
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
17 changes: 16 additions & 1 deletion test/sharness/t0235-cli-request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@ test_expect_success "can make http request against nc server" '
ipfs cat /ipfs/Qmabcdef --api /ip4/127.0.0.1/tcp/5005 &
IPFSPID=$!
# handle request
# handle request for /api/v0/version
while read line; do
if [[ "$line" == "$(echo -e "\r")" ]]; then
break
fi
echo "$line"
done <&7 >nc_out &&
echo -e "HTTP/1.1 200 OK\r" >&6 &&
echo -e "Content-Type: application/json\r" >&6 &&
echo -e "Content-Length: 21\r" >&6 &&
echo -e "\r" >&6 &&
echo -e "{\"Version\":\"0.23.0\"}\r" >&6 &&
echo -e "\r" >&6 &&
# handle request for /api/v0/cat
while read line; do
if [[ "$line" == "$(echo -e "\r")" ]]; then
break
Expand Down
17 changes: 16 additions & 1 deletion test/sharness/t0236-cli-api-dns-resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,22 @@ test_expect_success "can make http request against dns resolved nc server" '
ipfs cat /ipfs/Qmabcdef --api /dns4/localhost/tcp/5006 &
IPFSPID=$!
# handle request
# handle request for /api/v0/version
while read line; do
if [[ "$line" == "$(echo -e "\r")" ]]; then
break
fi
echo "$line"
done <&7 >nc_out &&
echo -e "HTTP/1.1 200 OK\r" >&6 &&
echo -e "Content-Type: application/json\r" >&6 &&
echo -e "Content-Length: 21\r" >&6 &&
echo -e "\r" >&6 &&
echo -e "{\"Version\":\"0.23.0\"}\r" >&6 &&
echo -e "\r" >&6 &&
# handle request for /api/v0/cat
while read line; do
if [[ "$line" == "$(echo -e "\r")" ]]; then
break
Expand Down

0 comments on commit cb456df

Please sign in to comment.