2017-11-28 22:45:10 +00:00
|
|
|
#!/bin/bash
|
2017-08-29 01:41:54 +00:00
|
|
|
|
|
|
|
test_description="Test service + ctl SSL interaction"
|
|
|
|
|
|
|
|
config="`pwd`/config/ssl-basic_auth"
|
|
|
|
|
|
|
|
. lib/test-lib.sh
|
|
|
|
|
|
|
|
test_ipfs_init
|
|
|
|
test_cluster_init "$config"
|
|
|
|
|
|
|
|
test_expect_success "prerequisites" '
|
|
|
|
test_have_prereq IPFS && test_have_prereq CLUSTER
|
|
|
|
'
|
|
|
|
|
2017-10-16 17:04:29 +00:00
|
|
|
test_expect_success "ssl interaction fails with bad credentials" '
|
|
|
|
id=`cluster_id`
|
|
|
|
{ test_must_fail ipfs-cluster-ctl --no-check-certificate --basic-auth "testuser:badpass" id; } | grep -A1 "401" | grep "Unauthorized"
|
|
|
|
'
|
|
|
|
|
2017-08-29 01:41:54 +00:00
|
|
|
test_expect_success "ssl interaction succeeds" '
|
|
|
|
id=`cluster_id`
|
2017-10-16 17:04:29 +00:00
|
|
|
ipfs-cluster-ctl --no-check-certificate --basic-auth "userwithoutpass" id | egrep -q "$id" &&
|
2017-08-29 01:41:54 +00:00
|
|
|
ipfs-cluster-ctl --no-check-certificate --basic-auth "testuser:testpass" id | egrep -q "$id"
|
|
|
|
'
|
|
|
|
|
2018-01-09 19:17:21 +00:00
|
|
|
test_clean_ipfs
|
|
|
|
test_clean_cluster
|
|
|
|
|
2017-08-29 01:41:54 +00:00
|
|
|
test_done
|