mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 17:03:58 +08:00
added sharness/t0061-daemon-opts
Test odd daemon options, like: - unrestricted-api - disable-transport-encryption (known breakage atm) License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
This commit is contained in:
@ -193,8 +193,10 @@ test_config_ipfs_gateway_writable() {
|
|||||||
|
|
||||||
test_launch_ipfs_daemon() {
|
test_launch_ipfs_daemon() {
|
||||||
|
|
||||||
|
args=$1
|
||||||
|
|
||||||
test_expect_success "'ipfs daemon' succeeds" '
|
test_expect_success "'ipfs daemon' succeeds" '
|
||||||
ipfs daemon >actual_daemon 2>daemon_err &
|
ipfs daemon $args >actual_daemon 2>daemon_err &
|
||||||
'
|
'
|
||||||
|
|
||||||
# we say the daemon is ready when the API server is ready.
|
# we say the daemon is ready when the API server is ready.
|
||||||
|
39
test/sharness/t0061-daemon-opts.sh
Executable file
39
test/sharness/t0061-daemon-opts.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Juan Batiz-Benet
|
||||||
|
# MIT Licensed; see the LICENSE file in this repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
test_description="Test daemon command"
|
||||||
|
|
||||||
|
. lib/test-lib.sh
|
||||||
|
|
||||||
|
|
||||||
|
test_init_ipfs
|
||||||
|
|
||||||
|
test_launch_ipfs_daemon '--unrestricted-api --disable-transport-encryption'
|
||||||
|
|
||||||
|
gwyport=$PORT_GWAY
|
||||||
|
apiport=$PORT_API
|
||||||
|
|
||||||
|
test_expect_success 'api gateway should be unrestricted' '
|
||||||
|
echo "hello mars :$gwyport :$apiport" >expected &&
|
||||||
|
HASH=$(ipfs add -q expected) &&
|
||||||
|
curl -sfo actual1 "http://127.0.0.1:$gwyport/ipfs/$HASH" &&
|
||||||
|
curl -sfo actual2 "http://127.0.0.1:$apiport/ipfs/$HASH" &&
|
||||||
|
test_cmp expected actual1 &&
|
||||||
|
test_cmp expected actual2
|
||||||
|
'
|
||||||
|
|
||||||
|
# Odd. this fails here, but the inverse works on t0060-daemon.
|
||||||
|
test_expect_failure 'transport should be unencrypted' '
|
||||||
|
nc 127.0.0.1 "$PORT_SWARM" >swarmnc &
|
||||||
|
go-sleep 0.1s &&
|
||||||
|
! grep -q "AES-256,AES-128" swarmnc &&
|
||||||
|
grep -q "/ipfs/identify" swarmnc ||
|
||||||
|
test_fsh cat swarmnc
|
||||||
|
'
|
||||||
|
|
||||||
|
test_kill_ipfs_daemon
|
||||||
|
|
||||||
|
test_done
|
@ -33,6 +33,10 @@ test_expect_success "GET IPFS path output looks good" '
|
|||||||
rm actual
|
rm actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success "GET IPFS path on API forbidden" '
|
||||||
|
test_curl_resp_http_code "http://127.0.0.1:$apiport/ipfs/$HASH" "HTTP/1.1 403 Forbidden"
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success "GET IPFS directory path succeeds" '
|
test_expect_success "GET IPFS directory path succeeds" '
|
||||||
mkdir dir &&
|
mkdir dir &&
|
||||||
echo "12345" >dir/test &&
|
echo "12345" >dir/test &&
|
||||||
|
Reference in New Issue
Block a user