Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs/kubo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dd265b7f0344
Choose a base ref
...
head repository: ipfs/kubo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 54bd1bd9e885
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Aug 28, 2015

  1. test-lib: use all the test_launch_ipfs_daemon() arguments

    It is simpler and less error prone to just pass to `ipfs daemon`
    all the arguments that are passed to test_launch_ipfs_daemon().
    
    Maybe the arguments should be shell quoted too, but that's
    another issue.
    
    License: MIT
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    chriscool committed Aug 28, 2015
    Copy the full SHA
    e1d8200 View commit details
  2. Fix test cases for ipfs api check

    License: MIT
    Signed-off-by: rht <rhtbot@gmail.com>
    rht committed Aug 28, 2015
    Copy the full SHA
    54bd1bd View commit details
Showing with 16 additions and 20 deletions.
  1. +1 −1 test/sharness/lib/test-lib.sh
  2. +1 −1 test/sharness/t0061-daemon-opts.sh
  3. +14 −18 test/sharness/t0062-daemon-api.sh
2 changes: 1 addition & 1 deletion test/sharness/lib/test-lib.sh
Original file line number Diff line number Diff line change
@@ -193,7 +193,7 @@ test_config_ipfs_gateway_writable() {

test_launch_ipfs_daemon() {

args=$1
args="$@"

test_expect_success "'ipfs daemon' succeeds" '
ipfs daemon $args >actual_daemon 2>daemon_err &
2 changes: 1 addition & 1 deletion test/sharness/t0061-daemon-opts.sh
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ test_description="Test daemon command"

test_init_ipfs

test_launch_ipfs_daemon '--unrestricted-api --disable-transport-encryption'
test_launch_ipfs_daemon --unrestricted-api --disable-transport-encryption

gwyport=$PORT_GWAY
apiport=$PORT_API
32 changes: 14 additions & 18 deletions test/sharness/t0062-daemon-api.sh
Original file line number Diff line number Diff line change
@@ -9,8 +9,15 @@ test_description="Test daemon command"

test_init_ipfs

test_expect_success "client should work when there is no api file" '
ipfs --api "$differentapi" id
differentport=$((PORT_API + 1))
differentapi="/ip4/127.0.0.1/tcp/$differentport"

test_expect_success "client should work when there is no api file and no --api is specified" '
ipfs id
'

test_expect_success "client should err when there is no api file and with --api is specified" '
test_must_fail ipfs --api "$differentapi" id
'

test_launch_ipfs_daemon
@@ -19,8 +26,10 @@ test_expect_success "'ipfs daemon' creates api file" '
test -f ".ipfs/api"
'

differentport=$((PORT_API + 1))
differentapi="/ip4/127.0.0.1/tcp/$differentport"
test_expect_success "api file looks good" '
printf "$ADDR_API" > expected &&
test_cmp expected .ipfs/api
'

test_expect_success "client should err if client api != api file while daemon is on" '
echo "Error: api not running" >expected &&
@@ -39,20 +48,7 @@ test_expect_success "client should err if client api != api file while daemon is
PORT_API=$differentport
ADDR_API=$differentapi

# test_launch_ipfs_daemon '--api "$ADDR_API"'

#pasted from test_launch_ipfs_daemon because the above line doesn't work
test_expect_success "'ipfs daemon' succeeds" '
ipfs daemon --api $ADDR_API >actual_daemon 2>daemon_err &
'

# we say the daemon is ready when the API server is ready.
test_expect_success "'ipfs daemon' is ready" '
IPFS_PID=$! &&
pollEndpoint -ep=/version -host=$ADDR_API -v -tout=1s -tries=60 2>poll_apierr > poll_apiout ||
test_fsh cat actual_daemon || test_fsh cat daemon_err || test_fsh cat poll_apierr || test_fsh cat poll_apiout
'
#end of "test_launch_ipfs_daemon
test_launch_ipfs_daemon --api "$ADDR_API"

test_expect_success "'ipfs daemon' api option works" '
printf "$differentapi" > expected &&