Fix tests
License: MIT Signed-off-by: Hector Sanjuan <hector@protocol.ai>
This commit is contained in:
parent
7066d52364
commit
dac6fcd18d
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,6 +2,9 @@ coverage.out
|
|||
ipfs-cluster-service/ipfs-cluster-service
|
||||
ipfs-cluster-ctl/ipfs-cluster-ctl
|
||||
deptools
|
||||
sharness/lib/sharness
|
||||
sharness/test-results
|
||||
sharness/trash*
|
||||
|
||||
raftFolderFromTest*
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ install:
|
|||
- make deps
|
||||
script:
|
||||
#- make test_problem
|
||||
#- make service && make ctl && ./coverage.sh
|
||||
- make service && make ctl && ./coverage.sh
|
||||
- make install
|
||||
- make test_sharness && make clean_sharness
|
||||
env:
|
||||
|
|
4
Makefile
4
Makefile
|
@ -64,9 +64,7 @@ test: deps
|
|||
go test -tags silent -v ./...
|
||||
|
||||
test_sharness: $(sharness)
|
||||
#@sh sharness/run-sharness-tests.sh
|
||||
@sh sharness/t0040-ssl-simple-exchange.sh.sh
|
||||
@sh sharness/t0041-ssl-simple-exchange.sh.sh
|
||||
@sh sharness/run-sharness-tests.sh
|
||||
|
||||
test_problem: deps
|
||||
go test -tags debug -v -run $(problematic_test)
|
||||
|
|
|
@ -35,7 +35,7 @@ test_ipfs_init() {
|
|||
echo "Error running go-ipfs in docker."
|
||||
exit 1
|
||||
fi
|
||||
sleep 6
|
||||
sleep 10
|
||||
fi
|
||||
test_set_prereq IPFS
|
||||
}
|
||||
|
@ -62,23 +62,22 @@ test_cluster_init() {
|
|||
echo "ipfs-cluster-ctl not found"
|
||||
exit 1
|
||||
fi
|
||||
export CLUSTER_TEMP_DIR=`mktemp -d cluster-XXXXX`
|
||||
ipfs-cluster-service -f --config "$CLUSTER_TEMP_DIR" init >"$IPFS_OUTPUT" 2>&1
|
||||
ipfs-cluster-service -f --config "test-config" init >"$IPFS_OUTPUT" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "error initializing ipfs cluster"
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$custom_config_files" ]; then
|
||||
cp -f ${custom_config_files}/* "$CLUSTER_TEMP_DIR"
|
||||
cp -f ${custom_config_files}/* "test-config"
|
||||
fi
|
||||
ipfs-cluster-service --config "$CLUSTER_TEMP_DIR" >"$IPFS_OUTPUT" 2>&1 &
|
||||
ipfs-cluster-service --config "test-config" >"$IPFS_OUTPUT" 2>&1 &
|
||||
export CLUSTER_D_PID=$!
|
||||
sleep 5
|
||||
test_set_prereq CLUSTER
|
||||
}
|
||||
|
||||
test_cluster_config() {
|
||||
export CLUSTER_CONFIG_PATH="${CLUSTER_TEMP_DIR}/service.json"
|
||||
export CLUSTER_CONFIG_PATH="test-config/service.json"
|
||||
export CLUSTER_CONFIG_ID=`jq --raw-output ".id" $CLUSTER_CONFIG_PATH`
|
||||
export CLUSTER_CONFIG_PK=`jq --raw-output ".private_key" $CLUSTER_CONFIG_PATH`
|
||||
[ "$CLUSTER_CONFIG_ID" != "null" ] && [ "$CLUSTER_CONFIG_PK" != "null" ]
|
||||
|
@ -97,5 +96,5 @@ test_clean_ipfs(){
|
|||
|
||||
test_clean_cluster(){
|
||||
kill -1 "$CLUSTER_D_PID"
|
||||
rm -rf "$CLUSTER_TEMP_DIR"
|
||||
rm -rf test-config
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
"leave_on_shutdown": false,
|
||||
"cluster_multiaddress": "/ip4/0.0.0.0/tcp/9096",
|
||||
"api_listen_multiaddress": "/ip4/127.0.0.1/tcp/9094",
|
||||
"ssl_cert_file": "server.crt",
|
||||
"ssl_key_file": "server.key",
|
||||
"ssl_cert_file": "test-config/server.crt",
|
||||
"ssl_key_file": "test-config/server.key",
|
||||
"ipfs_proxy_listen_multiaddress": "/ip4/127.0.0.1/tcp/9095",
|
||||
"ipfs_node_multiaddress": "/ip4/127.0.0.1/tcp/5001",
|
||||
"state_sync_seconds": 60,
|
||||
|
|
|
@ -10,8 +10,9 @@ test_cluster_init
|
|||
cleanup test_clean_cluster
|
||||
|
||||
test_expect_success IPFS,CLUSTER,JQ "cluster-ctl can read id" '
|
||||
test_cluster_config
|
||||
id=`cluster_id`
|
||||
test_cluster_config && ipfs-cluster-ctl id | egrep -q "$id"
|
||||
[ -n "$id"] && ipfs-cluster-ctl id | egrep -q "$id"
|
||||
'
|
||||
|
||||
test_expect_success IPFS,CLUSTER "cluster-ctl list 0 peers" '
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
test_description="Test service + ctl SSL interaction"
|
||||
|
||||
ssl_config="`pwd`/ssl"
|
||||
|
@ -10,12 +8,18 @@ ssl_config="`pwd`/ssl"
|
|||
|
||||
test_ipfs_init
|
||||
cleanup test_clean_ipfs
|
||||
|
||||
test_cluster_init "$ssl_config"
|
||||
cleanup test_clean_cluster
|
||||
|
||||
test_expect_success "prerequisites" '
|
||||
test_have_prereq IPFS && test_have_prereq CLUSTER
|
||||
'
|
||||
|
||||
test_expect_success "ssl interaction succeeds" '
|
||||
test_cluster_config
|
||||
id=`cluster_id`
|
||||
test_cluster_config && ipfs-cluster-ctl --https --no-check-certificate id | egrep -q "$id"
|
||||
ipfs-cluster-ctl --https --no-check-certificate id | egrep -q "$id"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
test_description="Test failure when server not using SSL but client requests it"
|
||||
|
||||
. lib/test-lib.sh
|
||||
|
@ -11,9 +9,14 @@ cleanup test_clean_ipfs
|
|||
test_cluster_init
|
||||
cleanup test_clean_cluster
|
||||
|
||||
test_expect_success "prerequisites" '
|
||||
test_have_prereq IPFS && test_have_prereq CLUSTER
|
||||
'
|
||||
|
||||
test_expect_success "ssl enforced by client" '
|
||||
test_cluster_config
|
||||
id=`cluster_id`
|
||||
test_cluster_config && test_must_fail ipfs-cluster-ctl --https --no-check-certificate id | egrep -q "$id"
|
||||
test_must_fail ipfs-cluster-ctl --https --no-check-certificate id
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in New Issue
Block a user