Code

t/integration/simple_query: Added test doing a simple query.
authorSebastian Harl <sh@tokkee.org>
Mon, 28 Apr 2014 06:00:30 +0000 (08:00 +0200)
committerSebastian Harl <sh@tokkee.org>
Mon, 28 Apr 2014 06:00:30 +0000 (08:00 +0200)
t/Makefile.am
t/integration/simple_query.sh [new file with mode: 0755]

index b40d090e3be773b4339830e61f088781f16b75b1..562ee1da7f9c3ea6b296a380aa74b9fdf4af1c7c 100644 (file)
@@ -47,7 +47,7 @@ unit_libsysdb_net_test_LDADD = $(top_builddir)/src/libsysdb.la @CHECK_LIBS@
 # integration tests
 #
 
-TESTS += integration/simple_config.sh
+TESTS += integration/simple_config.sh integration/simple_query.sh
 
 noinst_LTLIBRARIES += integration/mock_plugin.la
 integration_mock_plugin_la_SOURCES = integration/mock_plugin.c
diff --git a/t/integration/simple_query.sh b/t/integration/simple_query.sh
new file mode 100755 (executable)
index 0000000..37c57a1
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/bash
+#
+# SysDB -- t/integration/simple_query.sh
+# Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#
+# Integration tests using simple queries.
+#
+
+set -e
+
+source "$( dirname "$0" )/test_lib.sh"
+
+cat <<EOF > "$TESTDIR/sysdbd.conf"
+Listen "$SOCKET_FILE"
+PluginDir "$PLUGIN_DIR"
+Interval 2
+
+LoadBackend mock_plugin
+<Backend "test::integration::mock">
+</Backend>
+EOF
+
+"$TOP_SRCDIR/src/sysdbd" -D -C "$TESTDIR/sysdbd.conf" &
+sysdbd_pid=$!
+
+wait_for_sysdbd
+sleep 3
+
+"$TOP_SRCDIR/src/sysdb" -H "$SOCKET_FILE" -c LIST \
+       | grep -F '"host1.example.com"' \
+       | grep -F "host2.example.com" \
+       | grep -F "localhost" \
+       | grep -F "other.host.name" \
+       | grep -F "some.host.name"
+kill $!