From: Sebastian Harl Date: Mon, 28 Apr 2014 06:00:30 +0000 (+0200) Subject: t/integration/simple_query: Added test doing a simple query. X-Git-Tag: sysdb-0.1.0~69 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=97aa30ed76096fbd663290d340de40a9ca7acdab;p=sysdb.git t/integration/simple_query: Added test doing a simple query. --- diff --git a/t/Makefile.am b/t/Makefile.am index b40d090..562ee1d 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -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 index 0000000..37c57a1 --- /dev/null +++ b/t/integration/simple_query.sh @@ -0,0 +1,58 @@ +#! /bin/bash +# +# SysDB -- t/integration/simple_query.sh +# Copyright (C) 2012 Sebastian 'tokkee' Harl +# 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 < "$TESTDIR/sysdbd.conf" +Listen "$SOCKET_FILE" +PluginDir "$PLUGIN_DIR" +Interval 2 + +LoadBackend mock_plugin + + +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 $!