kubo/test/sharness/t0020-init.sh
Juan Batiz-Benet f1d34a2a85 test/sharness: fix errors
- core: daemon stdout print to cmd + daemon init checks
- core: fixed bug where the gateway was printed as "API"
- sharness/test-lib: daemon init checks
- sharness/test-lib: portable TCP port check
- sharness/init: fix test bits output
- sharness: use common hashes in one place.
- move t0100-http-gateway -> t0111-gateway-writable
- sharness: test-lib funcs for gateway config
- sharness/t0111-gateway-writable: use sh funcs
- sharness/t0111-gateway-writable: fixes
  - escape all vars (always `cmd "$VAR"` never `cmd $VAR`)
  - use $FILEPATH, not $path
  - last test seems to fail
2015-01-31 22:54:34 -08:00

48 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
test_description="Test init command"
. lib/test-lib.sh
test_expect_success "ipfs init succeeds" '
export IPFS_PATH="$(pwd)/.go-ipfs" &&
BITS="2048" &&
ipfs init --bits="$BITS" >actual_init
'
test_expect_success ".go-ipfs/ has been created" '
test -d ".go-ipfs" &&
test -f ".go-ipfs/config" &&
test -d ".go-ipfs/datastore" ||
fsh ls -al .go-ipfs
'
test_expect_success "ipfs config succeeds" '
echo leveldb >expected_config &&
ipfs config Datastore.Type >actual_config &&
test_cmp expected_config actual_config
'
test_expect_success "ipfs peer id looks good" '
PEERID=$(ipfs config Identity.PeerID) &&
echo $PEERID | tr -dC "[:alnum:]" | wc -c | tr -d " " >actual_peerid &&
echo "46" >expected_peerid &&
test_cmp expected_peerid actual_peerid
'
test_expect_success "ipfs init output looks good" '
STARTFILE="ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme" &&
echo "initializing ipfs node at $IPFS_PATH" >expected &&
echo "generating $BITS-bit RSA keypair...done" >>expected &&
echo "peer identity: $PEERID" >>expected &&
echo "to get started, enter:" >>expected &&
printf "\\n\\t$STARTFILE\\n\\n" >>expected &&
test_cmp expected actual_init
'
test_done