From 748d25f473d05076e1f1de0d75d939c54a41c160 Mon Sep 17 00:00:00 2001
From: Juan Batiz-Benet <juan@benet.ai>
Date: Fri, 19 Jun 2015 05:13:04 -0700
Subject: [PATCH] t0060-daemon: test transport is encrypted

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
---
 test/sharness/t0060-daemon.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/test/sharness/t0060-daemon.sh b/test/sharness/t0060-daemon.sh
index e0aff7b5e..eaffe6384 100755
--- a/test/sharness/t0060-daemon.sh
+++ b/test/sharness/t0060-daemon.sh
@@ -8,6 +8,8 @@ test_description="Test daemon command"
 
 . lib/test-lib.sh
 
+# TODO: randomize ports here once we add --config to ipfs daemon
+
 # this needs to be in a different test than "ipfs daemon --init" below
 test_expect_success "setup IPFS_PATH" '
   IPFS_PATH="$(pwd)/.ipfs" &&
@@ -91,6 +93,16 @@ test_expect_success "ipfs help output looks good" '
 	test_fsh cat help.txt
 '
 
+# check transport is encrypted
+
+test_expect_success 'transport should be encrypted' '
+  nc localhost 4001 >swarmnc &
+  go-sleep 0.1s &&
+  grep -q "AES-256,AES-128" swarmnc &&
+  ! grep -q "/ipfs/identify" swarmnc ||
+	test_fsh cat swarmnc
+'
+
 # end same as in t0010
 
 test_expect_success "daemon is still running" '
-- 
GitLab