1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

ctdb-tests: 50.samba event script setup modularisation

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2018-02-12 16:25:15 +11:00 committed by Amitay Isaacs
parent 34eba35c61
commit ab5bc195c4
17 changed files with 49 additions and 30 deletions

View File

@ -4,7 +4,7 @@
define_test "not managed, check no-op"
setup_samba "down"
setup "down"
ok_null

View File

@ -4,7 +4,7 @@
define_test "all OK"
setup_samba
setup
ok_null

View File

@ -4,7 +4,8 @@
define_test "port 445 down"
setup_samba
setup
tcp_port_down 445
required_result 1 "samba not listening on TCP port 445"

View File

@ -4,7 +4,8 @@
define_test "port 139 down"
setup_samba
setup
tcp_port_down 139
required_result 1 "samba not listening on TCP port 139"

View File

@ -4,7 +4,7 @@
define_test "non-existent share path"
setup_samba
setup
out=$(shares_missing "ERROR: samba directory \"%s\" not available" 2)

View File

@ -4,9 +4,9 @@
define_test "non-existent share - not checked"
setup_samba
setup
export CTDB_SAMBA_SKIP_SHARE_CHECK="yes"
CTDB_SAMBA_SKIP_SHARE_CHECK="yes"
ok_null

View File

@ -4,7 +4,7 @@
define_test "testparm fails"
setup_samba
setup
export FAKE_TESTPARM_FAIL="yes"
required_result 1 <<EOF

View File

@ -4,7 +4,7 @@
define_test "testparm fails on 2nd time through"
setup_samba
setup
ok_null
simple_test

View File

@ -4,7 +4,7 @@
define_test "testparm times out"
setup_samba
setup
export FAKE_TIMEOUT="yes"
required_result 1 <<EOF

View File

@ -4,7 +4,7 @@
define_test "testparm times out on 2nd time through"
setup_samba
setup
ok_null
simple_test

View File

@ -4,7 +4,7 @@
define_test "shutdown, simple"
setup_samba
setup
ok <<EOF
Stopping smb: OK

View File

@ -4,7 +4,7 @@
define_test "shutdown, simple"
setup_samba
setup
samba_setup_fake_threads 1 2 3 4 5 6

View File

@ -4,7 +4,7 @@
define_test "shutdown, Debian init style"
setup_samba
setup
export EVENTSCRIPT_TESTS_INIT_STYLE="debian"

View File

@ -4,7 +4,7 @@
define_test "shutdown, Debian init style"
setup_samba
setup
export EVENTSCRIPT_TESTS_INIT_STYLE="debian"

View File

@ -1,7 +1,5 @@
setup_samba ()
setup ()
{
setup_ctdb
service_name="samba"
if [ "$1" != "down" ] ; then
@ -13,11 +11,9 @@ setup_samba ()
service "$i" force-started
done
export CTDB_SAMBA_SKIP_SHARE_CHECK="no"
export CTDB_MANAGES_SAMBA="yes"
export FAKE_TCP_LISTEN="0.0.0.0:445 0.0.0.0:139"
export FAKE_WBINFO_FAIL="no"
setup_tcp_listen 445 139
# Some things in 50.samba are backgrounded and waited
# for. If we don't sleep at all then timeouts can
@ -31,12 +27,15 @@ setup_samba ()
service "$i" force-stopped
done
export CTDB_SAMBA_SKIP_SHARE_CHECK="no"
export CTDB_MANAGES_SAMBA=""
export FAKE_TCP_LISTEN=""
export FAKE_WBINFO_FAIL="yes"
setup_tcp_listen
fi
export CTDB_SAMBA_SKIP_SHARE_CHECK="no"
setup_shares
}
samba_setup_fake_threads ()

View File

@ -90,16 +90,34 @@ setup_generic ()
setup_shares
setup_dbdir
setup_date
}
export FAKE_TCP_LISTEN
setup_tcp_listen ()
{
export FAKE_TCP_LISTEN="$*"
}
tcp_port_listening ()
{
for _i ; do
FAKE_TCP_LISTEN="${FAKE_TCP_LISTEN} ${_i}"
done
}
tcp_port_down ()
{
for _i ; do
debug "Marking TCP port \"${_i}\" as not listening"
FAKE_TCP_LISTEN=$(echo "$FAKE_TCP_LISTEN" | sed -r -e "s@[[:space:]]*[\.0-9]+:${_i}@@g")
_port="$1"
debug "Marking TCP port \"${_port}\" as not listening"
_t=""
for _i in $FAKE_TCP_LISTEN ; do
if [ "$_i" = "$_port" ] ; then
continue
fi
_t="${_t} ${_i}"
done
FAKE_TCP_LISTEN="$_t"
}
setup_unix_listen ()

View File

@ -458,7 +458,7 @@ ctdb_checktcpport ()
_port="$1"
for _i in $FAKE_TCP_LISTEN ; do
if [ "$_port" = "${_i##*:}" ] ; then
if [ "$_port" = "$_i" ] ; then
exit 98
fi
done