diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-06-06 17:42:09 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-06-06 17:42:09 +0200 |
commit | 0095cd3f7e69a7a3b9455e923011fb484d2a81b3 (patch) | |
tree | 6ef2f3c4ba4601d5ad57485af06bbd9854ddd212 | |
parent | 95f0eacb25e5192e5339326ef4320154e5ae9a2b (diff) | |
download | twister-0095cd3f7e69a7a3b9455e923011fb484d2a81b3.tar.gz twister-0095cd3f7e69a7a3b9455e923011fb484d2a81b3.tar.bz2 twister-0095cd3f7e69a7a3b9455e923011fb484d2a81b3.zip |
testing IPC
-rw-r--r-- | src/test/test_twister_ipc.conf | 27 | ||||
-rwxr-xr-x | src/test/test_twister_ipc.sh | 73 |
2 files changed, 100 insertions, 0 deletions
diff --git a/src/test/test_twister_ipc.conf b/src/test/test_twister_ipc.conf new file mode 100644 index 0000000..0d9cc63 --- /dev/null +++ b/src/test/test_twister_ipc.conf @@ -0,0 +1,27 @@ +[twister] +# HTTP listen port for twister +HTTP_PORT = 8888 +SERVE = unix +SERVE_UNIXPATH = /tmp/http-twister.sock +SERVE_UNIXMODE = 660 + +# HTTP Destination for twister. The test-Webserver needs +# to listen on the port used here. +# Note: no trailing '/'! +DESTINATION_BASE_URL = http://localhost:8080 + +# Control port for TCP +# PORT = 8889 +HOSTNAME = localhost +ACCEPT_FROM = 127.0.0.1; +ACCEPT_FROM6 = ::1; + +# Control port for UNIX +UNIXPATH = /tmp/taler-service-twister.sock +UNIX_MATCH_UID = NO +UNIX_MATCH_GID = YES + +# Launching of twister by ARM +# BINARY = taler-service-twister +# AUTOSTART = NO +# FORCESTART = NO diff --git a/src/test/test_twister_ipc.sh b/src/test/test_twister_ipc.sh new file mode 100755 index 0000000..2830daf --- /dev/null +++ b/src/test/test_twister_ipc.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# This file is part of GNUnet. +# Copyright (C) 2018 Taler Systems SA +# +# Twister is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version +# 3, or (at your option) any later version. +# +# Twister is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with Twister; see the file COPYING. If not, +# write to the Free Software Foundation, Inc., 51 Franklin +# Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# @author Marcello Stanisci +# @author Christian Grothoff +# +# @file test_twister.sh +# +# @brief Twister testcases. + + +if ! which curl > /dev/null +then + echo "curl not found"; + exit 77 +fi + +TWISTER_UNIXPATH="/tmp/http-twister.sock" +TWISTER_DUMMY_URL="http://dummyhost/" + +# Launch the Web server. +./test_twister_webserver & +web_server_pid=$! + +echo Webserver launched. + +# Launch the Twister. +taler-twister-service -c ./test_twister_ipc.conf & +twister_service_pid=$! + +echo Twister launched. + +sleep 1 +if ! ps xo pid | grep -q ${twister_service_pid}; then + echo Twister did not start correctly + return 77 +fi + +status_code=$(curl -s --unix-socket ${TWISTER_UNIXPATH} \ + ${TWISTER_DUMMY_URL} -o /dev/null -w "%{http_code}") + +# check status code was hacked +if ! test 200 = $status_code; then + echo "Could not reach the Twister (${status_code})" + kill $web_server_pid + kill $twister_service_pid + exit 1 +fi + +echo "Twister reached via IPC". + +# shutdown twister and webserver +kill $web_server_pid +kill $twister_service_pid + +exit 0 |