From 4f5791ebd03eaec1c7da0865a383175b05102712 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 19:47:29 +0200 Subject: Adding upstream version 2:4.17.12+dfsg. Signed-off-by: Daniel Baumann --- ctdb/tests/UNIT/cunit/cluster_mutex_001.sh | 66 + ctdb/tests/UNIT/cunit/cluster_mutex_002.sh | 132 ++ ctdb/tests/UNIT/cunit/cluster_mutex_003.sh | 75 + ctdb/tests/UNIT/cunit/cmdline_test_001.sh | 98 ++ ctdb/tests/UNIT/cunit/comm_test_001.sh | 13 + ctdb/tests/UNIT/cunit/comm_test_002.sh | 24 + ctdb/tests/UNIT/cunit/conf_test_001.sh | 196 +++ ctdb/tests/UNIT/cunit/config_test_001.sh | 115 ++ ctdb/tests/UNIT/cunit/config_test_002.sh | 65 + ctdb/tests/UNIT/cunit/config_test_003.sh | 52 + ctdb/tests/UNIT/cunit/config_test_004.sh | 144 ++ ctdb/tests/UNIT/cunit/config_test_005.sh | 97 ++ ctdb/tests/UNIT/cunit/config_test_006.sh | 56 + ctdb/tests/UNIT/cunit/config_test_007.sh | 24 + ctdb/tests/UNIT/cunit/ctdb_io_test_001.sh | 10 + ctdb/tests/UNIT/cunit/db_hash_test_001.sh | 7 + ctdb/tests/UNIT/cunit/event_protocol_test_001.sh | 7 + ctdb/tests/UNIT/cunit/event_script_test_001.sh | 127 ++ ctdb/tests/UNIT/cunit/hash_count_test_001.sh | 7 + ctdb/tests/UNIT/cunit/line_test_001.sh | 90 + ctdb/tests/UNIT/cunit/path_tests_001.sh | 62 + ctdb/tests/UNIT/cunit/pidfile_test_001.sh | 8 + ctdb/tests/UNIT/cunit/pkt_read_001.sh | 7 + ctdb/tests/UNIT/cunit/pkt_write_001.sh | 7 + ctdb/tests/UNIT/cunit/porting_tests_001.sh | 15 + ctdb/tests/UNIT/cunit/protocol_test_001.sh | 7 + ctdb/tests/UNIT/cunit/protocol_test_002.sh | 7 + ctdb/tests/UNIT/cunit/protocol_test_012.sh | 7 + ctdb/tests/UNIT/cunit/protocol_test_101.sh | 7 + ctdb/tests/UNIT/cunit/protocol_test_111.sh | 7 + ctdb/tests/UNIT/cunit/protocol_test_201.sh | 6 + ctdb/tests/UNIT/cunit/rb_test_001.sh | 31 + ctdb/tests/UNIT/cunit/reqid_test_001.sh | 13 + ctdb/tests/UNIT/cunit/run_event_001.sh | 137 ++ ctdb/tests/UNIT/cunit/run_proc_001.sh | 159 ++ ctdb/tests/UNIT/cunit/sock_daemon_test_001.sh | 135 ++ ctdb/tests/UNIT/cunit/sock_io_test_001.sh | 9 + ctdb/tests/UNIT/cunit/srvid_test_001.sh | 7 + ctdb/tests/UNIT/cunit/system_socket_test_001.sh | 6 + ctdb/tests/UNIT/cunit/system_socket_test_002.sh | 68 + ctdb/tests/UNIT/cunit/system_socket_test_003.sh | 42 + ctdb/tests/UNIT/cunit/tmon_test_001.sh | 195 +++ ctdb/tests/UNIT/cunit/tmon_test_002.sh | 142 ++ ctdb/tests/UNIT/cunit/tunable_test_001.sh | 312 ++++ ctdb/tests/UNIT/eventd/README | 1 + ctdb/tests/UNIT/eventd/etc-ctdb/ctdb.conf | 6 + ctdb/tests/UNIT/eventd/etc-ctdb/debug-script.sh | 22 + .../eventd/etc-ctdb/events/data/03.notalink.script | 2 + ctdb/tests/UNIT/eventd/etc-ctdb/events/data/README | 1 + .../tests/UNIT/eventd/etc-ctdb/events/empty/README | 1 + .../eventd/etc-ctdb/events/multi/01.test.script | 11 + .../eventd/etc-ctdb/events/multi/02.test.script | 9 + .../eventd/etc-ctdb/events/multi/03.test.script | 9 + .../etc-ctdb/events/random/01.disabled.script | 3 + .../etc-ctdb/events/random/02.enabled.script | 12 + .../eventd/etc-ctdb/events/random/README.script | 1 + .../UNIT/eventd/etc-ctdb/events/random/a.script | 3 + .../etc-ctdb/share/events/data/01.dummy.script | 6 + .../etc-ctdb/share/events/data/02.disabled.script | 6 + .../UNIT/eventd/etc-ctdb/share/events/empty/README | 1 + .../share/events/random/01.disabled.script | 3 + .../etc-ctdb/share/events/random/02.enabled.script | 12 + .../etc-ctdb/share/events/random/README.script | 1 + .../eventd/etc-ctdb/share/events/random/a.script | 3 + ctdb/tests/UNIT/eventd/eventd_001.sh | 27 + ctdb/tests/UNIT/eventd/eventd_002.sh | 21 + ctdb/tests/UNIT/eventd/eventd_003.sh | 45 + ctdb/tests/UNIT/eventd/eventd_004.sh | 33 + ctdb/tests/UNIT/eventd/eventd_005.sh | 34 + ctdb/tests/UNIT/eventd/eventd_006.sh | 19 + ctdb/tests/UNIT/eventd/eventd_007.sh | 19 + ctdb/tests/UNIT/eventd/eventd_008.sh | 19 + ctdb/tests/UNIT/eventd/eventd_009.sh | 155 ++ ctdb/tests/UNIT/eventd/eventd_011.sh | 40 + ctdb/tests/UNIT/eventd/eventd_012.sh | 27 + ctdb/tests/UNIT/eventd/eventd_013.sh | 27 + ctdb/tests/UNIT/eventd/eventd_014.sh | 27 + ctdb/tests/UNIT/eventd/eventd_021.sh | 26 + ctdb/tests/UNIT/eventd/eventd_022.sh | 22 + ctdb/tests/UNIT/eventd/eventd_023.sh | 22 + ctdb/tests/UNIT/eventd/eventd_024.sh | 31 + ctdb/tests/UNIT/eventd/eventd_031.sh | 17 + ctdb/tests/UNIT/eventd/eventd_032.sh | 43 + ctdb/tests/UNIT/eventd/eventd_033.sh | 43 + ctdb/tests/UNIT/eventd/eventd_041.sh | 26 + ctdb/tests/UNIT/eventd/eventd_042.sh | 29 + ctdb/tests/UNIT/eventd/eventd_043.sh | 29 + ctdb/tests/UNIT/eventd/eventd_044.sh | 37 + ctdb/tests/UNIT/eventd/eventd_051.sh | 15 + ctdb/tests/UNIT/eventd/eventd_052.sh | 35 + ctdb/tests/UNIT/eventd/scripts/local.sh | 122 ++ ctdb/tests/UNIT/eventscripts/00.ctdb.init.001.sh | 13 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.002.sh | 17 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.003.sh | 16 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.004.sh | 18 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.005.sh | 20 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.006.sh | 23 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.007.sh | 16 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.008.sh | 19 + ctdb/tests/UNIT/eventscripts/00.ctdb.init.009.sh | 51 + .../tests/UNIT/eventscripts/01.reclock.init.001.sh | 10 + .../tests/UNIT/eventscripts/01.reclock.init.002.sh | 10 + .../tests/UNIT/eventscripts/01.reclock.init.003.sh | 20 + .../UNIT/eventscripts/05.system.monitor.001.sh | 13 + .../UNIT/eventscripts/05.system.monitor.002.sh | 14 + .../UNIT/eventscripts/05.system.monitor.003.sh | 17 + .../UNIT/eventscripts/05.system.monitor.004.sh | 15 + .../UNIT/eventscripts/05.system.monitor.005.sh | 17 + .../UNIT/eventscripts/05.system.monitor.006.sh | 17 + .../UNIT/eventscripts/05.system.monitor.007.sh | 14 + .../UNIT/eventscripts/05.system.monitor.011.sh | 13 + .../UNIT/eventscripts/05.system.monitor.012.sh | 14 + .../UNIT/eventscripts/05.system.monitor.014.sh | 18 + .../UNIT/eventscripts/05.system.monitor.015.sh | 20 + .../UNIT/eventscripts/05.system.monitor.017.sh | 20 + .../UNIT/eventscripts/05.system.monitor.018.sh | 82 + .../UNIT/eventscripts/06.nfs.releaseip.001.sh | 12 + .../UNIT/eventscripts/06.nfs.releaseip.002.sh | 12 + ctdb/tests/UNIT/eventscripts/06.nfs.takeip.001.sh | 12 + ctdb/tests/UNIT/eventscripts/06.nfs.takeip.002.sh | 12 + ctdb/tests/UNIT/eventscripts/10.interface.010.sh | 23 + ctdb/tests/UNIT/eventscripts/10.interface.011.sh | 28 + ctdb/tests/UNIT/eventscripts/10.interface.012.sh | 31 + ctdb/tests/UNIT/eventscripts/10.interface.013.sh | 36 + .../UNIT/eventscripts/10.interface.init.001.sh | 13 + .../UNIT/eventscripts/10.interface.init.002.sh | 11 + .../UNIT/eventscripts/10.interface.init.021.sh | 11 + .../UNIT/eventscripts/10.interface.init.022.sh | 18 + .../UNIT/eventscripts/10.interface.init.023.sh | 23 + .../UNIT/eventscripts/10.interface.monitor.001.sh | 13 + .../UNIT/eventscripts/10.interface.monitor.002.sh | 11 + .../UNIT/eventscripts/10.interface.monitor.003.sh | 15 + .../UNIT/eventscripts/10.interface.monitor.004.sh | 15 + .../UNIT/eventscripts/10.interface.monitor.005.sh | 15 + .../UNIT/eventscripts/10.interface.monitor.006.sh | 15 + .../UNIT/eventscripts/10.interface.monitor.009.sh | 19 + .../UNIT/eventscripts/10.interface.monitor.010.sh | 25 + .../UNIT/eventscripts/10.interface.monitor.011.sh | 21 + .../UNIT/eventscripts/10.interface.monitor.012.sh | 29 + .../UNIT/eventscripts/10.interface.monitor.013.sh | 15 + .../UNIT/eventscripts/10.interface.monitor.014.sh | 16 + .../UNIT/eventscripts/10.interface.monitor.015.sh | 16 + .../UNIT/eventscripts/10.interface.monitor.016.sh | 20 + .../UNIT/eventscripts/10.interface.monitor.017.sh | 20 + .../UNIT/eventscripts/10.interface.monitor.018.sh | 20 + .../UNIT/eventscripts/10.interface.multi.001.sh | 14 + .../eventscripts/10.interface.releaseip.001.sh | 13 + .../eventscripts/10.interface.releaseip.002.sh | 14 + .../UNIT/eventscripts/10.interface.startup.001.sh | 13 + .../UNIT/eventscripts/10.interface.startup.002.sh | 11 + .../UNIT/eventscripts/10.interface.takeip.001.sh | 13 + .../UNIT/eventscripts/10.interface.takeip.002.sh | 13 + .../UNIT/eventscripts/10.interface.takeip.003.sh | 22 + ctdb/tests/UNIT/eventscripts/11.natgw.001.sh | 12 + ctdb/tests/UNIT/eventscripts/11.natgw.002.sh | 24 + ctdb/tests/UNIT/eventscripts/11.natgw.003.sh | 24 + ctdb/tests/UNIT/eventscripts/11.natgw.004.sh | 24 + ctdb/tests/UNIT/eventscripts/11.natgw.011.sh | 23 + ctdb/tests/UNIT/eventscripts/11.natgw.012.sh | 23 + ctdb/tests/UNIT/eventscripts/11.natgw.013.sh | 27 + ctdb/tests/UNIT/eventscripts/11.natgw.014.sh | 27 + ctdb/tests/UNIT/eventscripts/11.natgw.015.sh | 61 + ctdb/tests/UNIT/eventscripts/11.natgw.021.sh | 27 + ctdb/tests/UNIT/eventscripts/11.natgw.022.sh | 27 + ctdb/tests/UNIT/eventscripts/11.natgw.023.sh | 27 + ctdb/tests/UNIT/eventscripts/11.natgw.024.sh | 27 + ctdb/tests/UNIT/eventscripts/11.natgw.025.sh | 65 + ctdb/tests/UNIT/eventscripts/11.natgw.031.sh | 62 + ctdb/tests/UNIT/eventscripts/11.natgw.041.sh | 24 + ctdb/tests/UNIT/eventscripts/11.natgw.042.sh | 25 + ctdb/tests/UNIT/eventscripts/11.natgw.051.sh | 17 + ctdb/tests/UNIT/eventscripts/11.natgw.052.sh | 21 + ctdb/tests/UNIT/eventscripts/11.natgw.053.sh | 17 + ctdb/tests/UNIT/eventscripts/11.natgw.054.sh | 21 + .../UNIT/eventscripts/13.per_ip_routing.001.sh | 19 + .../UNIT/eventscripts/13.per_ip_routing.002.sh | 18 + .../UNIT/eventscripts/13.per_ip_routing.003.sh | 16 + .../UNIT/eventscripts/13.per_ip_routing.004.sh | 17 + .../UNIT/eventscripts/13.per_ip_routing.005.sh | 20 + .../UNIT/eventscripts/13.per_ip_routing.006.sh | 24 + .../UNIT/eventscripts/13.per_ip_routing.007.sh | 17 + .../UNIT/eventscripts/13.per_ip_routing.008.sh | 23 + .../UNIT/eventscripts/13.per_ip_routing.009.sh | 20 + .../UNIT/eventscripts/13.per_ip_routing.010.sh | 19 + .../UNIT/eventscripts/13.per_ip_routing.011.sh | 21 + .../UNIT/eventscripts/13.per_ip_routing.012.sh | 29 + .../UNIT/eventscripts/13.per_ip_routing.013.sh | 23 + .../UNIT/eventscripts/13.per_ip_routing.014.sh | 29 + .../UNIT/eventscripts/13.per_ip_routing.015.sh | 29 + .../UNIT/eventscripts/13.per_ip_routing.016.sh | 14 + .../UNIT/eventscripts/13.per_ip_routing.017.sh | 15 + .../UNIT/eventscripts/13.per_ip_routing.018.sh | 21 + .../UNIT/eventscripts/13.per_ip_routing.019.sh | 23 + .../UNIT/eventscripts/13.per_ip_routing.021.sh | 15 + .../UNIT/eventscripts/13.per_ip_routing.022.sh | 15 + .../UNIT/eventscripts/13.per_ip_routing.023.sh | 25 + .../UNIT/eventscripts/13.per_ip_routing.024.sh | 30 + .../UNIT/eventscripts/20.multipathd.monitor.001.sh | 11 + .../UNIT/eventscripts/20.multipathd.monitor.002.sh | 11 + .../UNIT/eventscripts/20.multipathd.monitor.003.sh | 14 + .../UNIT/eventscripts/20.multipathd.monitor.004.sh | 15 + .../UNIT/eventscripts/31.clamd.monitor.002.sh | 16 + .../UNIT/eventscripts/31.clamd.monitor.003.sh | 16 + .../UNIT/eventscripts/40.vsftpd.monitor.002.sh | 19 + .../UNIT/eventscripts/40.vsftpd.shutdown.002.sh | 12 + .../UNIT/eventscripts/40.vsftpd.startup.002.sh | 12 + .../UNIT/eventscripts/41.httpd.monitor.002.sh | 30 + .../UNIT/eventscripts/41.httpd.shutdown.002.sh | 12 + .../UNIT/eventscripts/41.httpd.startup.002.sh | 12 + .../UNIT/eventscripts/48.netbios.shutdown.011.sh | 14 + .../UNIT/eventscripts/48.netbios.startup.011.sh | 14 + .../UNIT/eventscripts/49.winbind.monitor.101.sh | 11 + .../UNIT/eventscripts/49.winbind.monitor.102.sh | 13 + .../UNIT/eventscripts/49.winbind.shutdown.002.sh | 12 + .../UNIT/eventscripts/49.winbind.startup.002.sh | 12 + .../UNIT/eventscripts/50.samba.monitor.101.sh | 11 + .../UNIT/eventscripts/50.samba.monitor.103.sh | 13 + .../UNIT/eventscripts/50.samba.monitor.104.sh | 13 + .../UNIT/eventscripts/50.samba.monitor.105.sh | 12 + .../UNIT/eventscripts/50.samba.monitor.106.sh | 15 + .../UNIT/eventscripts/50.samba.monitor.110.sh | 20 + .../UNIT/eventscripts/50.samba.monitor.111.sh | 25 + .../UNIT/eventscripts/50.samba.monitor.112.sh | 13 + .../UNIT/eventscripts/50.samba.monitor.113.sh | 16 + .../UNIT/eventscripts/50.samba.shutdown.001.sh | 12 + .../UNIT/eventscripts/50.samba.shutdown.002.sh | 15 + .../UNIT/eventscripts/50.samba.shutdown.011.sh | 14 + .../UNIT/eventscripts/50.samba.startup.011.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.101.sh | 11 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.102.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.103.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.104.sh | 17 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.105.sh | 10 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.106.sh | 11 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.107.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.108.sh | 12 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.109.sh | 12 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.111.sh | 13 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.112.sh | 13 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.113.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.114.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.121.sh | 15 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.122.sh | 18 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.131.sh | 11 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.132.sh | 15 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.141.sh | 13 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.142.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.143.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.144.sh | 13 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.151.sh | 13 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.152.sh | 15 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.153.sh | 15 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.161.sh | 12 + ctdb/tests/UNIT/eventscripts/60.nfs.monitor.162.sh | 15 + ctdb/tests/UNIT/eventscripts/60.nfs.multi.001.sh | 19 + ctdb/tests/UNIT/eventscripts/60.nfs.multi.002.sh | 17 + .../UNIT/eventscripts/60.nfs.releaseip.001.sh | 14 + .../UNIT/eventscripts/60.nfs.releaseip.002.sh | 12 + .../tests/UNIT/eventscripts/60.nfs.shutdown.001.sh | 14 + .../tests/UNIT/eventscripts/60.nfs.shutdown.002.sh | 12 + ctdb/tests/UNIT/eventscripts/60.nfs.startup.001.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.startup.002.sh | 12 + ctdb/tests/UNIT/eventscripts/60.nfs.takeip.001.sh | 14 + ctdb/tests/UNIT/eventscripts/60.nfs.takeip.002.sh | 12 + ctdb/tests/UNIT/eventscripts/91.lvs.001.sh | 54 + .../UNIT/eventscripts/91.lvs.ipreallocated.011.sh | 14 + .../UNIT/eventscripts/91.lvs.ipreallocated.012.sh | 17 + .../UNIT/eventscripts/91.lvs.ipreallocated.013.sh | 17 + .../UNIT/eventscripts/91.lvs.ipreallocated.014.sh | 27 + ctdb/tests/UNIT/eventscripts/91.lvs.monitor.001.sh | 11 + ctdb/tests/UNIT/eventscripts/91.lvs.monitor.002.sh | 14 + ctdb/tests/UNIT/eventscripts/91.lvs.monitor.003.sh | 19 + .../tests/UNIT/eventscripts/91.lvs.shutdown.001.sh | 11 + .../tests/UNIT/eventscripts/91.lvs.shutdown.002.sh | 18 + ctdb/tests/UNIT/eventscripts/91.lvs.startup.001.sh | 11 + ctdb/tests/UNIT/eventscripts/91.lvs.startup.002.sh | 14 + ctdb/tests/UNIT/eventscripts/README | 46 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.001.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.002.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.003.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.004.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.005.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.006.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.007.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.008.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.021.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.022.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.023.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.024.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.025.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.026.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.027.sh | 9 + ctdb/tests/UNIT/eventscripts/debug_locks.sh.028.sh | 9 + .../UNIT/eventscripts/etc-ctdb/public_addresses | 9 + ctdb/tests/UNIT/eventscripts/etc-ctdb/rc.local | 59 + ctdb/tests/UNIT/eventscripts/etc/init.d/nfs | 7 + ctdb/tests/UNIT/eventscripts/etc/init.d/nfslock | 7 + ctdb/tests/UNIT/eventscripts/etc/samba/smb.conf | 42 + ctdb/tests/UNIT/eventscripts/etc/sysconfig/nfs | 2 + ctdb/tests/UNIT/eventscripts/scripts/00.ctdb.sh | 29 + ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh | 16 + ctdb/tests/UNIT/eventscripts/scripts/05.system.sh | 46 + ctdb/tests/UNIT/eventscripts/scripts/06.nfs.sh | 4 + .../UNIT/eventscripts/scripts/10.interface.sh | 72 + ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh | 119 ++ .../UNIT/eventscripts/scripts/13.per_ip_routing.sh | 42 + .../UNIT/eventscripts/scripts/20.multipathd.sh | 24 + ctdb/tests/UNIT/eventscripts/scripts/31.clamd.sh | 8 + ctdb/tests/UNIT/eventscripts/scripts/40.vsftpd.sh | 12 + ctdb/tests/UNIT/eventscripts/scripts/41.httpd.sh | 14 + ctdb/tests/UNIT/eventscripts/scripts/48.netbios.sh | 21 + ctdb/tests/UNIT/eventscripts/scripts/49.winbind.sh | 26 + ctdb/tests/UNIT/eventscripts/scripts/50.samba.sh | 54 + ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh | 436 +++++ ctdb/tests/UNIT/eventscripts/scripts/91.lvs.sh | 76 + .../tests/UNIT/eventscripts/scripts/debug_locks.sh | 255 +++ ctdb/tests/UNIT/eventscripts/scripts/local.sh | 550 ++++++ .../UNIT/eventscripts/scripts/statd-callout.sh | 65 + ctdb/tests/UNIT/eventscripts/statd-callout.001.sh | 13 + ctdb/tests/UNIT/eventscripts/statd-callout.002.sh | 14 + ctdb/tests/UNIT/eventscripts/statd-callout.003.sh | 16 + ctdb/tests/UNIT/eventscripts/statd-callout.004.sh | 17 + ctdb/tests/UNIT/eventscripts/statd-callout.005.sh | 25 + ctdb/tests/UNIT/eventscripts/statd-callout.006.sh | 27 + ctdb/tests/UNIT/eventscripts/statd-callout.007.sh | 14 + ctdb/tests/UNIT/eventscripts/stubs/ctdb | 496 ++++++ ctdb/tests/UNIT/eventscripts/stubs/ctdb-config | 2 + ctdb/tests/UNIT/eventscripts/stubs/ctdb_killtcp | 9 + ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs | 52 + ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw | 34 + ctdb/tests/UNIT/eventscripts/stubs/date | 7 + ctdb/tests/UNIT/eventscripts/stubs/df | 38 + ctdb/tests/UNIT/eventscripts/stubs/ethtool | 12 + ctdb/tests/UNIT/eventscripts/stubs/exportfs | 13 + ctdb/tests/UNIT/eventscripts/stubs/gstack | 19 + ctdb/tests/UNIT/eventscripts/stubs/id | 3 + ctdb/tests/UNIT/eventscripts/stubs/ip | 679 ++++++++ ctdb/tests/UNIT/eventscripts/stubs/ip6tables | 5 + ctdb/tests/UNIT/eventscripts/stubs/iptables | 5 + ctdb/tests/UNIT/eventscripts/stubs/ipvsadm | 126 ++ ctdb/tests/UNIT/eventscripts/stubs/kill | 7 + ctdb/tests/UNIT/eventscripts/stubs/killall | 7 + ctdb/tests/UNIT/eventscripts/stubs/multipath | 36 + ctdb/tests/UNIT/eventscripts/stubs/net | 5 + .../tests/UNIT/eventscripts/stubs/nfs-fake-callout | 15 + ctdb/tests/UNIT/eventscripts/stubs/nfsconf | 5 + ctdb/tests/UNIT/eventscripts/stubs/pidof | 16 + ctdb/tests/UNIT/eventscripts/stubs/pkill | 7 + ctdb/tests/UNIT/eventscripts/stubs/ps | 48 + ctdb/tests/UNIT/eventscripts/stubs/rm | 6 + ctdb/tests/UNIT/eventscripts/stubs/rpc.lockd | 6 + ctdb/tests/UNIT/eventscripts/stubs/rpc.mountd | 6 + ctdb/tests/UNIT/eventscripts/stubs/rpc.rquotad | 6 + ctdb/tests/UNIT/eventscripts/stubs/rpc.statd | 6 + ctdb/tests/UNIT/eventscripts/stubs/rpcinfo | 73 + ctdb/tests/UNIT/eventscripts/stubs/service | 64 + ctdb/tests/UNIT/eventscripts/stubs/sleep | 9 + ctdb/tests/UNIT/eventscripts/stubs/smnotify | 38 + ctdb/tests/UNIT/eventscripts/stubs/ss | 193 +++ ctdb/tests/UNIT/eventscripts/stubs/stat | 71 + ctdb/tests/UNIT/eventscripts/stubs/tdb_mutex_check | 10 + ctdb/tests/UNIT/eventscripts/stubs/tdbdump | 9 + ctdb/tests/UNIT/eventscripts/stubs/tdbtool | 33 + ctdb/tests/UNIT/eventscripts/stubs/testparm | 85 + ctdb/tests/UNIT/eventscripts/stubs/timeout | 8 + ctdb/tests/UNIT/eventscripts/stubs/wbinfo | 7 + ctdb/tests/UNIT/onnode/0001.sh | 24 + ctdb/tests/UNIT/onnode/0002.sh | 16 + ctdb/tests/UNIT/onnode/0003.sh | 16 + ctdb/tests/UNIT/onnode/0004.sh | 16 + ctdb/tests/UNIT/onnode/0005.sh | 13 + ctdb/tests/UNIT/onnode/0006.sh | 15 + ctdb/tests/UNIT/onnode/0010.sh | 13 + ctdb/tests/UNIT/onnode/0011.sh | 13 + ctdb/tests/UNIT/onnode/0070.sh | 32 + ctdb/tests/UNIT/onnode/0071.sh | 29 + ctdb/tests/UNIT/onnode/0072.sh | 29 + ctdb/tests/UNIT/onnode/0075.sh | 29 + ctdb/tests/UNIT/onnode/etc-ctdb/nodes | 4 + ctdb/tests/UNIT/onnode/scripts/local.sh | 64 + ctdb/tests/UNIT/onnode/stubs/ctdb | 19 + ctdb/tests/UNIT/onnode/stubs/ssh | 2 + ctdb/tests/UNIT/shellcheck/base_scripts.sh | 12 + ctdb/tests/UNIT/shellcheck/ctdb_helpers.sh | 9 + ctdb/tests/UNIT/shellcheck/event_scripts.sh | 7 + ctdb/tests/UNIT/shellcheck/functions.sh | 7 + ctdb/tests/UNIT/shellcheck/init_script.sh | 19 + ctdb/tests/UNIT/shellcheck/scripts/local.sh | 33 + ctdb/tests/UNIT/shellcheck/tests.sh | 31 + ctdb/tests/UNIT/shellcheck/tools.sh | 9 + ctdb/tests/UNIT/takeover/README | 5 + ctdb/tests/UNIT/takeover/det.001.sh | 36 + ctdb/tests/UNIT/takeover/det.002.sh | 33 + ctdb/tests/UNIT/takeover/det.003.sh | 30 + ctdb/tests/UNIT/takeover/lcp2.001.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.002.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.003.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.004.sh | 37 + ctdb/tests/UNIT/takeover/lcp2.005.sh | 198 +++ ctdb/tests/UNIT/takeover/lcp2.006.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.007.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.008.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.009.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.010.sh | 32 + ctdb/tests/UNIT/takeover/lcp2.011.sh | 45 + ctdb/tests/UNIT/takeover/lcp2.012.sh | 33 + ctdb/tests/UNIT/takeover/lcp2.013.sh | 33 + ctdb/tests/UNIT/takeover/lcp2.014.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.015.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.016.sh | 31 + ctdb/tests/UNIT/takeover/lcp2.024.sh | 42 + ctdb/tests/UNIT/takeover/lcp2.025.sh | 33 + ctdb/tests/UNIT/takeover/lcp2.027.sh | 45 + ctdb/tests/UNIT/takeover/lcp2.028.sh | 45 + ctdb/tests/UNIT/takeover/lcp2.029.sh | 111 ++ ctdb/tests/UNIT/takeover/lcp2.030.sh | 1813 ++++++++++++++++++++ ctdb/tests/UNIT/takeover/lcp2.031.sh | 143 ++ ctdb/tests/UNIT/takeover/lcp2.032.sh | 450 +++++ ctdb/tests/UNIT/takeover/lcp2.033.sh | 74 + ctdb/tests/UNIT/takeover/lcp2.034.sh | 21 + ctdb/tests/UNIT/takeover/lcp2.035.sh | 1813 ++++++++++++++++++++ ctdb/tests/UNIT/takeover/nondet.001.sh | 35 + ctdb/tests/UNIT/takeover/nondet.002.sh | 32 + ctdb/tests/UNIT/takeover/nondet.003.sh | 29 + ctdb/tests/UNIT/takeover/scripts/local.sh | 30 + ctdb/tests/UNIT/takeover_helper/000.sh | 22 + ctdb/tests/UNIT/takeover_helper/010.sh | 33 + ctdb/tests/UNIT/takeover_helper/011.sh | 33 + ctdb/tests/UNIT/takeover_helper/012.sh | 33 + ctdb/tests/UNIT/takeover_helper/013.sh | 33 + ctdb/tests/UNIT/takeover_helper/014.sh | 37 + ctdb/tests/UNIT/takeover_helper/016.sh | 36 + ctdb/tests/UNIT/takeover_helper/017.sh | 36 + ctdb/tests/UNIT/takeover_helper/018.sh | 34 + ctdb/tests/UNIT/takeover_helper/019.sh | 37 + ctdb/tests/UNIT/takeover_helper/021.sh | 39 + ctdb/tests/UNIT/takeover_helper/022.sh | 40 + ctdb/tests/UNIT/takeover_helper/023.sh | 41 + ctdb/tests/UNIT/takeover_helper/024.sh | 43 + ctdb/tests/UNIT/takeover_helper/025.sh | 37 + ctdb/tests/UNIT/takeover_helper/026.sh | 41 + ctdb/tests/UNIT/takeover_helper/027.sh | 33 + ctdb/tests/UNIT/takeover_helper/028.sh | 33 + ctdb/tests/UNIT/takeover_helper/030.sh | 35 + ctdb/tests/UNIT/takeover_helper/031.sh | 55 + ctdb/tests/UNIT/takeover_helper/110.sh | 29 + ctdb/tests/UNIT/takeover_helper/111.sh | 40 + ctdb/tests/UNIT/takeover_helper/120.sh | 40 + ctdb/tests/UNIT/takeover_helper/121.sh | 40 + ctdb/tests/UNIT/takeover_helper/122.sh | 40 + ctdb/tests/UNIT/takeover_helper/130.sh | 41 + ctdb/tests/UNIT/takeover_helper/131.sh | 40 + ctdb/tests/UNIT/takeover_helper/132.sh | 42 + ctdb/tests/UNIT/takeover_helper/140.sh | 33 + ctdb/tests/UNIT/takeover_helper/150.sh | 31 + ctdb/tests/UNIT/takeover_helper/160.sh | 31 + ctdb/tests/UNIT/takeover_helper/210.sh | 29 + ctdb/tests/UNIT/takeover_helper/211.sh | 40 + ctdb/tests/UNIT/takeover_helper/220.sh | 40 + ctdb/tests/UNIT/takeover_helper/230.sh | 41 + ctdb/tests/UNIT/takeover_helper/240.sh | 33 + ctdb/tests/UNIT/takeover_helper/250.sh | 31 + ctdb/tests/UNIT/takeover_helper/260.sh | 31 + ctdb/tests/UNIT/takeover_helper/scripts/local.sh | 108 ++ ctdb/tests/UNIT/tool/README | 17 + ctdb/tests/UNIT/tool/ctdb.attach.001.sh | 35 + ctdb/tests/UNIT/tool/ctdb.attach.002.sh | 35 + ctdb/tests/UNIT/tool/ctdb.attach.003.sh | 35 + ctdb/tests/UNIT/tool/ctdb.ban.001.sh | 35 + ctdb/tests/UNIT/tool/ctdb.ban.002.sh | 23 + ctdb/tests/UNIT/tool/ctdb.ban.003.sh | 23 + ctdb/tests/UNIT/tool/ctdb.catdb.001.sh | 80 + ctdb/tests/UNIT/tool/ctdb.catdb.002.sh | 86 + ctdb/tests/UNIT/tool/ctdb.cattdb.001.sh | 80 + ctdb/tests/UNIT/tool/ctdb.cattdb.002.sh | 86 + ctdb/tests/UNIT/tool/ctdb.continue.001.sh | 23 + ctdb/tests/UNIT/tool/ctdb.continue.002.sh | 23 + ctdb/tests/UNIT/tool/ctdb.continue.003.sh | 23 + ctdb/tests/UNIT/tool/ctdb.deletekey.001.sh | 34 + ctdb/tests/UNIT/tool/ctdb.disable.001.sh | 23 + ctdb/tests/UNIT/tool/ctdb.disable.002.sh | 23 + ctdb/tests/UNIT/tool/ctdb.disable.003.sh | 23 + ctdb/tests/UNIT/tool/ctdb.disable.004.sh | 15 + ctdb/tests/UNIT/tool/ctdb.enable.001.sh | 23 + ctdb/tests/UNIT/tool/ctdb.enable.002.sh | 23 + ctdb/tests/UNIT/tool/ctdb.enable.003.sh | 23 + ctdb/tests/UNIT/tool/ctdb.getcapabilities.001.sh | 19 + ctdb/tests/UNIT/tool/ctdb.getcapabilities.002.sh | 19 + ctdb/tests/UNIT/tool/ctdb.getcapabilities.003.sh | 28 + ctdb/tests/UNIT/tool/ctdb.getcapabilities.004.sh | 39 + ctdb/tests/UNIT/tool/ctdb.getdbmap.001.sh | 34 + ctdb/tests/UNIT/tool/ctdb.getdbseqnum.001.sh | 41 + ctdb/tests/UNIT/tool/ctdb.getdbseqnum.002.sh | 36 + ctdb/tests/UNIT/tool/ctdb.getdbstatus.001.sh | 108 ++ ctdb/tests/UNIT/tool/ctdb.getdbstatus.002.sh | 108 ++ ctdb/tests/UNIT/tool/ctdb.getpid.001.sh | 17 + ctdb/tests/UNIT/tool/ctdb.getpid.010.sh | 25 + ctdb/tests/UNIT/tool/ctdb.getreclock.001.sh | 16 + ctdb/tests/UNIT/tool/ctdb.getreclock.002.sh | 21 + ctdb/tests/UNIT/tool/ctdb.getvar.001.sh | 35 + ctdb/tests/UNIT/tool/ctdb.getvar.002.sh | 17 + ctdb/tests/UNIT/tool/ctdb.ifaces.001.sh | 24 + ctdb/tests/UNIT/tool/ctdb.ip.001.sh | 17 + ctdb/tests/UNIT/tool/ctdb.ip.002.sh | 17 + ctdb/tests/UNIT/tool/ctdb.ip.003.sh | 30 + ctdb/tests/UNIT/tool/ctdb.ip.004.sh | 29 + ctdb/tests/UNIT/tool/ctdb.ip.005.sh | 30 + ctdb/tests/UNIT/tool/ctdb.ip.006.sh | 30 + ctdb/tests/UNIT/tool/ctdb.ip.007.sh | 36 + ctdb/tests/UNIT/tool/ctdb.ipinfo.001.sh | 18 + ctdb/tests/UNIT/tool/ctdb.ipinfo.002.sh | 32 + ctdb/tests/UNIT/tool/ctdb.ipinfo.003.sh | 35 + ctdb/tests/UNIT/tool/ctdb.leader.001.sh | 16 + ctdb/tests/UNIT/tool/ctdb.leader.002.sh | 16 + ctdb/tests/UNIT/tool/ctdb.listnodes.001.sh | 20 + ctdb/tests/UNIT/tool/ctdb.listnodes.002.sh | 19 + ctdb/tests/UNIT/tool/ctdb.listvars.001.sh | 66 + ctdb/tests/UNIT/tool/ctdb.lvs.001.sh | 36 + ctdb/tests/UNIT/tool/ctdb.lvs.002.sh | 46 + ctdb/tests/UNIT/tool/ctdb.lvs.003.sh | 43 + ctdb/tests/UNIT/tool/ctdb.lvs.004.sh | 45 + ctdb/tests/UNIT/tool/ctdb.lvs.005.sh | 46 + ctdb/tests/UNIT/tool/ctdb.lvs.006.sh | 44 + ctdb/tests/UNIT/tool/ctdb.lvs.007.sh | 42 + ctdb/tests/UNIT/tool/ctdb.lvs.008.sh | 66 + ctdb/tests/UNIT/tool/ctdb.lvs.010.sh | 25 + ctdb/tests/UNIT/tool/ctdb.natgw.001.sh | 46 + ctdb/tests/UNIT/tool/ctdb.natgw.002.sh | 46 + ctdb/tests/UNIT/tool/ctdb.natgw.003.sh | 43 + ctdb/tests/UNIT/tool/ctdb.natgw.004.sh | 46 + ctdb/tests/UNIT/tool/ctdb.natgw.005.sh | 46 + ctdb/tests/UNIT/tool/ctdb.natgw.006.sh | 46 + ctdb/tests/UNIT/tool/ctdb.natgw.007.sh | 45 + ctdb/tests/UNIT/tool/ctdb.natgw.008.sh | 46 + ctdb/tests/UNIT/tool/ctdb.natgw.010.sh | 25 + ctdb/tests/UNIT/tool/ctdb.nodestatus.001.sh | 33 + ctdb/tests/UNIT/tool/ctdb.nodestatus.002.sh | 33 + ctdb/tests/UNIT/tool/ctdb.nodestatus.003.sh | 33 + ctdb/tests/UNIT/tool/ctdb.nodestatus.004.sh | 28 + ctdb/tests/UNIT/tool/ctdb.nodestatus.005.sh | 28 + ctdb/tests/UNIT/tool/ctdb.nodestatus.006.sh | 40 + ctdb/tests/UNIT/tool/ctdb.nodestatus.007.sh | 36 + ctdb/tests/UNIT/tool/ctdb.pdelete.001.sh | 27 + ctdb/tests/UNIT/tool/ctdb.ping.001.sh | 24 + ctdb/tests/UNIT/tool/ctdb.pnn.001.sh | 15 + ctdb/tests/UNIT/tool/ctdb.process-exists.001.sh | 28 + ctdb/tests/UNIT/tool/ctdb.process-exists.002.sh | 30 + ctdb/tests/UNIT/tool/ctdb.process-exists.003.sh | 30 + ctdb/tests/UNIT/tool/ctdb.pstore.001.sh | 24 + ctdb/tests/UNIT/tool/ctdb.ptrans.001.sh | 49 + ctdb/tests/UNIT/tool/ctdb.readkey.001.sh | 20 + ctdb/tests/UNIT/tool/ctdb.recover.001.sh | 22 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.001.sh | 24 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.002.sh | 30 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.003.sh | 29 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.011.sh | 25 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.012.sh | 24 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.013.sh | 26 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.014.sh | 24 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.015.sh | 26 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.016.sh | 24 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.017.sh | 26 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.018.sh | 29 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.019.sh | 28 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.020.sh | 28 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.021.sh | 26 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.023.sh | 24 + ctdb/tests/UNIT/tool/ctdb.reloadnodes.024.sh | 24 + ctdb/tests/UNIT/tool/ctdb.runstate.001.sh | 15 + ctdb/tests/UNIT/tool/ctdb.runstate.002.sh | 15 + ctdb/tests/UNIT/tool/ctdb.runstate.003.sh | 17 + ctdb/tests/UNIT/tool/ctdb.runstate.004.sh | 15 + ctdb/tests/UNIT/tool/ctdb.runstate.005.sh | 15 + ctdb/tests/UNIT/tool/ctdb.setdbreadonly.001.sh | 53 + ctdb/tests/UNIT/tool/ctdb.setdbreadonly.002.sh | 37 + ctdb/tests/UNIT/tool/ctdb.setdbreadonly.003.sh | 39 + ctdb/tests/UNIT/tool/ctdb.setdbreadonly.004.sh | 37 + ctdb/tests/UNIT/tool/ctdb.setdbreadonly.005.sh | 39 + ctdb/tests/UNIT/tool/ctdb.setdbsticky.001.sh | 53 + ctdb/tests/UNIT/tool/ctdb.setdbsticky.002.sh | 37 + ctdb/tests/UNIT/tool/ctdb.setdbsticky.003.sh | 39 + ctdb/tests/UNIT/tool/ctdb.setdbsticky.004.sh | 37 + ctdb/tests/UNIT/tool/ctdb.setdbsticky.005.sh | 39 + ctdb/tests/UNIT/tool/ctdb.setdebug.001.sh | 23 + ctdb/tests/UNIT/tool/ctdb.setdebug.002.sh | 23 + ctdb/tests/UNIT/tool/ctdb.setdebug.003.sh | 32 + ctdb/tests/UNIT/tool/ctdb.setifacelink.001.sh | 76 + ctdb/tests/UNIT/tool/ctdb.setifacelink.002.sh | 22 + ctdb/tests/UNIT/tool/ctdb.setvar.001.sh | 49 + ctdb/tests/UNIT/tool/ctdb.setvar.002.sh | 17 + ctdb/tests/UNIT/tool/ctdb.status.001.sh | 46 + ctdb/tests/UNIT/tool/ctdb.status.002.sh | 46 + ctdb/tests/UNIT/tool/ctdb.status.003.sh | 49 + ctdb/tests/UNIT/tool/ctdb.stop.001.sh | 23 + ctdb/tests/UNIT/tool/ctdb.stop.002.sh | 23 + ctdb/tests/UNIT/tool/ctdb.stop.003.sh | 23 + ctdb/tests/UNIT/tool/ctdb.unban.001.sh | 23 + ctdb/tests/UNIT/tool/ctdb.unban.002.sh | 34 + ctdb/tests/UNIT/tool/ctdb.unban.003.sh | 23 + ctdb/tests/UNIT/tool/ctdb.uptime.001.sh | 36 + ctdb/tests/UNIT/tool/ctdb.writekey.001.sh | 31 + ctdb/tests/UNIT/tool/scripts/local.sh | 112 ++ 602 files changed, 24039 insertions(+) create mode 100755 ctdb/tests/UNIT/cunit/cluster_mutex_001.sh create mode 100755 ctdb/tests/UNIT/cunit/cluster_mutex_002.sh create mode 100755 ctdb/tests/UNIT/cunit/cluster_mutex_003.sh create mode 100755 ctdb/tests/UNIT/cunit/cmdline_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/comm_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/comm_test_002.sh create mode 100755 ctdb/tests/UNIT/cunit/conf_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/config_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/config_test_002.sh create mode 100755 ctdb/tests/UNIT/cunit/config_test_003.sh create mode 100755 ctdb/tests/UNIT/cunit/config_test_004.sh create mode 100755 ctdb/tests/UNIT/cunit/config_test_005.sh create mode 100755 ctdb/tests/UNIT/cunit/config_test_006.sh create mode 100755 ctdb/tests/UNIT/cunit/config_test_007.sh create mode 100755 ctdb/tests/UNIT/cunit/ctdb_io_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/db_hash_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/event_protocol_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/event_script_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/hash_count_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/line_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/path_tests_001.sh create mode 100755 ctdb/tests/UNIT/cunit/pidfile_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/pkt_read_001.sh create mode 100755 ctdb/tests/UNIT/cunit/pkt_write_001.sh create mode 100755 ctdb/tests/UNIT/cunit/porting_tests_001.sh create mode 100755 ctdb/tests/UNIT/cunit/protocol_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/protocol_test_002.sh create mode 100755 ctdb/tests/UNIT/cunit/protocol_test_012.sh create mode 100755 ctdb/tests/UNIT/cunit/protocol_test_101.sh create mode 100755 ctdb/tests/UNIT/cunit/protocol_test_111.sh create mode 100755 ctdb/tests/UNIT/cunit/protocol_test_201.sh create mode 100755 ctdb/tests/UNIT/cunit/rb_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/reqid_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/run_event_001.sh create mode 100755 ctdb/tests/UNIT/cunit/run_proc_001.sh create mode 100755 ctdb/tests/UNIT/cunit/sock_daemon_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/sock_io_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/srvid_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/system_socket_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/system_socket_test_002.sh create mode 100755 ctdb/tests/UNIT/cunit/system_socket_test_003.sh create mode 100755 ctdb/tests/UNIT/cunit/tmon_test_001.sh create mode 100755 ctdb/tests/UNIT/cunit/tmon_test_002.sh create mode 100755 ctdb/tests/UNIT/cunit/tunable_test_001.sh create mode 100644 ctdb/tests/UNIT/eventd/README create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/ctdb.conf create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/debug-script.sh create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/events/data/03.notalink.script create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/events/data/README create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/events/empty/README create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/01.test.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/02.test.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/03.test.script create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/events/random/01.disabled.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/events/random/README.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/events/random/a.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/01.dummy.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/02.disabled.script create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/share/events/empty/README create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/01.disabled.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/02.enabled.script create mode 100644 ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/README.script create mode 100755 ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/a.script create mode 100755 ctdb/tests/UNIT/eventd/eventd_001.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_002.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_003.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_004.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_005.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_006.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_007.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_008.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_009.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_011.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_012.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_013.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_014.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_021.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_022.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_023.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_024.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_031.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_032.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_033.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_041.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_042.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_043.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_044.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_051.sh create mode 100755 ctdb/tests/UNIT/eventd/eventd_052.sh create mode 100644 ctdb/tests/UNIT/eventd/scripts/local.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.005.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.006.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.007.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.008.sh create mode 100755 ctdb/tests/UNIT/eventscripts/00.ctdb.init.009.sh create mode 100755 ctdb/tests/UNIT/eventscripts/01.reclock.init.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/01.reclock.init.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/01.reclock.init.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.005.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.006.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.007.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.012.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.014.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.015.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.017.sh create mode 100755 ctdb/tests/UNIT/eventscripts/05.system.monitor.018.sh create mode 100755 ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/06.nfs.takeip.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/06.nfs.takeip.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.010.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.012.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.013.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.init.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.init.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.init.021.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.init.022.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.init.023.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.005.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.006.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.009.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.010.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.012.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.013.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.014.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.015.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.016.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.017.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.monitor.018.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.multi.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.releaseip.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.releaseip.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.startup.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.startup.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.takeip.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.takeip.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/10.interface.takeip.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.012.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.013.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.014.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.015.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.021.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.022.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.023.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.024.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.025.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.031.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.041.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.042.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.051.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.052.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.053.sh create mode 100755 ctdb/tests/UNIT/eventscripts/11.natgw.054.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.005.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.006.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.007.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.008.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.009.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.010.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.012.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.013.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.014.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.015.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.016.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.017.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.018.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.019.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.021.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.022.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.023.sh create mode 100755 ctdb/tests/UNIT/eventscripts/13.per_ip_routing.024.sh create mode 100755 ctdb/tests/UNIT/eventscripts/20.multipathd.monitor.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/20.multipathd.monitor.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/20.multipathd.monitor.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/20.multipathd.monitor.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/31.clamd.monitor.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/31.clamd.monitor.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/40.vsftpd.monitor.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/40.vsftpd.shutdown.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/40.vsftpd.startup.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/41.httpd.monitor.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/41.httpd.shutdown.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/41.httpd.startup.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/48.netbios.shutdown.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/48.netbios.startup.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/49.winbind.monitor.101.sh create mode 100755 ctdb/tests/UNIT/eventscripts/49.winbind.monitor.102.sh create mode 100755 ctdb/tests/UNIT/eventscripts/49.winbind.shutdown.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/49.winbind.startup.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.101.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.103.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.104.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.105.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.106.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.110.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.111.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.112.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.monitor.113.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.shutdown.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.shutdown.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.shutdown.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.startup.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.101.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.102.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.103.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.104.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.105.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.106.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.107.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.108.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.109.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.111.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.112.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.113.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.114.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.121.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.122.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.131.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.132.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.141.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.142.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.143.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.144.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.151.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.152.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.153.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.161.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.162.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.multi.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.multi.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.releaseip.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.releaseip.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.shutdown.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.shutdown.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.startup.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.startup.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.takeip.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/60.nfs.takeip.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.011.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.012.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.013.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.014.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.monitor.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.monitor.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.monitor.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.shutdown.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.shutdown.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.startup.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/91.lvs.startup.002.sh create mode 100644 ctdb/tests/UNIT/eventscripts/README create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.005.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.006.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.007.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.008.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.021.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.022.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.023.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.024.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.025.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.026.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.027.sh create mode 100755 ctdb/tests/UNIT/eventscripts/debug_locks.sh.028.sh create mode 100644 ctdb/tests/UNIT/eventscripts/etc-ctdb/public_addresses create mode 100755 ctdb/tests/UNIT/eventscripts/etc-ctdb/rc.local create mode 100755 ctdb/tests/UNIT/eventscripts/etc/init.d/nfs create mode 100755 ctdb/tests/UNIT/eventscripts/etc/init.d/nfslock create mode 100644 ctdb/tests/UNIT/eventscripts/etc/samba/smb.conf create mode 100644 ctdb/tests/UNIT/eventscripts/etc/sysconfig/nfs create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/00.ctdb.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/05.system.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/06.nfs.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/10.interface.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/31.clamd.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/40.vsftpd.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/41.httpd.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/48.netbios.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/49.winbind.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/50.samba.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/91.lvs.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/local.sh create mode 100644 ctdb/tests/UNIT/eventscripts/scripts/statd-callout.sh create mode 100755 ctdb/tests/UNIT/eventscripts/statd-callout.001.sh create mode 100755 ctdb/tests/UNIT/eventscripts/statd-callout.002.sh create mode 100755 ctdb/tests/UNIT/eventscripts/statd-callout.003.sh create mode 100755 ctdb/tests/UNIT/eventscripts/statd-callout.004.sh create mode 100755 ctdb/tests/UNIT/eventscripts/statd-callout.005.sh create mode 100755 ctdb/tests/UNIT/eventscripts/statd-callout.006.sh create mode 100755 ctdb/tests/UNIT/eventscripts/statd-callout.007.sh create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ctdb create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ctdb-config create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ctdb_killtcp create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/date create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/df create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ethtool create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/exportfs create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/gstack create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/id create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ip create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ip6tables create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/iptables create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ipvsadm create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/kill create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/killall create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/multipath create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/net create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/nfs-fake-callout create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/nfsconf create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/pidof create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/pkill create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ps create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/rm create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/rpc.lockd create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/rpc.mountd create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/rpc.rquotad create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/rpc.statd create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/rpcinfo create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/service create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/sleep create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/smnotify create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/ss create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/stat create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/tdb_mutex_check create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/tdbdump create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/tdbtool create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/testparm create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/timeout create mode 100755 ctdb/tests/UNIT/eventscripts/stubs/wbinfo create mode 100755 ctdb/tests/UNIT/onnode/0001.sh create mode 100755 ctdb/tests/UNIT/onnode/0002.sh create mode 100755 ctdb/tests/UNIT/onnode/0003.sh create mode 100755 ctdb/tests/UNIT/onnode/0004.sh create mode 100755 ctdb/tests/UNIT/onnode/0005.sh create mode 100755 ctdb/tests/UNIT/onnode/0006.sh create mode 100755 ctdb/tests/UNIT/onnode/0010.sh create mode 100755 ctdb/tests/UNIT/onnode/0011.sh create mode 100755 ctdb/tests/UNIT/onnode/0070.sh create mode 100755 ctdb/tests/UNIT/onnode/0071.sh create mode 100755 ctdb/tests/UNIT/onnode/0072.sh create mode 100755 ctdb/tests/UNIT/onnode/0075.sh create mode 100644 ctdb/tests/UNIT/onnode/etc-ctdb/nodes create mode 100644 ctdb/tests/UNIT/onnode/scripts/local.sh create mode 100755 ctdb/tests/UNIT/onnode/stubs/ctdb create mode 100755 ctdb/tests/UNIT/onnode/stubs/ssh create mode 100755 ctdb/tests/UNIT/shellcheck/base_scripts.sh create mode 100755 ctdb/tests/UNIT/shellcheck/ctdb_helpers.sh create mode 100755 ctdb/tests/UNIT/shellcheck/event_scripts.sh create mode 100755 ctdb/tests/UNIT/shellcheck/functions.sh create mode 100755 ctdb/tests/UNIT/shellcheck/init_script.sh create mode 100644 ctdb/tests/UNIT/shellcheck/scripts/local.sh create mode 100755 ctdb/tests/UNIT/shellcheck/tests.sh create mode 100755 ctdb/tests/UNIT/shellcheck/tools.sh create mode 100644 ctdb/tests/UNIT/takeover/README create mode 100755 ctdb/tests/UNIT/takeover/det.001.sh create mode 100755 ctdb/tests/UNIT/takeover/det.002.sh create mode 100755 ctdb/tests/UNIT/takeover/det.003.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.001.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.002.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.003.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.004.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.005.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.006.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.007.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.008.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.009.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.010.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.011.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.012.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.013.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.014.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.015.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.016.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.024.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.025.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.027.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.028.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.029.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.030.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.031.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.032.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.033.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.034.sh create mode 100755 ctdb/tests/UNIT/takeover/lcp2.035.sh create mode 100755 ctdb/tests/UNIT/takeover/nondet.001.sh create mode 100755 ctdb/tests/UNIT/takeover/nondet.002.sh create mode 100755 ctdb/tests/UNIT/takeover/nondet.003.sh create mode 100644 ctdb/tests/UNIT/takeover/scripts/local.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/000.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/010.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/011.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/012.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/013.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/014.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/016.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/017.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/018.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/019.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/021.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/022.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/023.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/024.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/025.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/026.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/027.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/028.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/030.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/031.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/110.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/111.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/120.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/121.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/122.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/130.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/131.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/132.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/140.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/150.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/160.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/210.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/211.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/220.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/230.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/240.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/250.sh create mode 100755 ctdb/tests/UNIT/takeover_helper/260.sh create mode 100644 ctdb/tests/UNIT/takeover_helper/scripts/local.sh create mode 100644 ctdb/tests/UNIT/tool/README create mode 100755 ctdb/tests/UNIT/tool/ctdb.attach.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.attach.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.attach.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ban.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ban.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ban.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.catdb.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.catdb.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.cattdb.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.cattdb.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.continue.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.continue.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.continue.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.deletekey.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.disable.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.disable.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.disable.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.disable.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.enable.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.enable.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.enable.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getcapabilities.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getcapabilities.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getcapabilities.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getcapabilities.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getdbmap.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getdbseqnum.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getdbseqnum.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getdbstatus.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getdbstatus.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getpid.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getpid.010.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getreclock.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getreclock.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getvar.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.getvar.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ifaces.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ip.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ip.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ip.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ip.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ip.005.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ip.006.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ip.007.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ipinfo.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ipinfo.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ipinfo.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.leader.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.leader.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.listnodes.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.listnodes.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.listvars.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.005.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.006.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.007.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.008.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.lvs.010.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.005.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.006.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.007.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.008.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.natgw.010.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.nodestatus.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.nodestatus.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.nodestatus.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.nodestatus.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.nodestatus.005.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.nodestatus.006.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.nodestatus.007.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.pdelete.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ping.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.pnn.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.process-exists.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.process-exists.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.process-exists.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.pstore.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.ptrans.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.readkey.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.recover.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.011.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.012.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.013.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.014.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.015.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.016.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.017.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.018.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.019.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.020.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.021.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.023.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.reloadnodes.024.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.runstate.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.runstate.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.runstate.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.runstate.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.runstate.005.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbreadonly.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbreadonly.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbreadonly.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbreadonly.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbreadonly.005.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbsticky.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbsticky.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbsticky.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbsticky.004.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdbsticky.005.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdebug.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdebug.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setdebug.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setifacelink.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setifacelink.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setvar.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.setvar.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.status.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.status.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.status.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.stop.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.stop.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.stop.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.unban.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.unban.002.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.unban.003.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.uptime.001.sh create mode 100755 ctdb/tests/UNIT/tool/ctdb.writekey.001.sh create mode 100644 ctdb/tests/UNIT/tool/scripts/local.sh (limited to 'ctdb/tests/UNIT') diff --git a/ctdb/tests/UNIT/cunit/cluster_mutex_001.sh b/ctdb/tests/UNIT/cunit/cluster_mutex_001.sh new file mode 100755 index 0000000..7976143 --- /dev/null +++ b/ctdb/tests/UNIT/cunit/cluster_mutex_001.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +# This tests the fcntl helper, configured via a lock file + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +t="${CTDB_SCRIPTS_HELPER_BINDIR}/ctdb_mutex_fcntl_helper" +export CTDB_CLUSTER_MUTEX_HELPER="$t" + +lockfile="${CTDB_TEST_TMP_DIR}/cluster_mutex.lockfile" +trap 'rm -f ${lockfile}' 0 + +test_case "No contention: lock, unlock" +ok <] [] + +Help Options: + -h, --help Show this help message + +Options: + -c, --count=INT Option help of length thirty. + -v, --value=Value help of length 23 Short description + +Commands: + A really really long command This is a really long help message + short command short msg for short command +Usage: test4 [-h] [-h|--help] [-c|--count=INT] + [-v|--value=Value help of length 23] [] + + short command short msg for short command +EOF +unit_test cmdline_test 4 + +ok <] [] + +Help Options: + -h, --help Show this help message + +Action Commands: + action one action one help + action two action two help +Usage: test5 [] [] + +Help Options: + -h, --help Show this help message + +Action Commands: + action one action one help + action two action two help +Usage: test5 [] [] + +Help Options: + -h, --help Show this help message + +Action Commands: + action one action one help + action two action two help +EOF +unit_test cmdline_test 5 + +ok <] [] + +Help Options: + -h, --help Show this help message + +Basic Commands: + cmd1 command one help + cmd2 command two help + +Advanced Commands: + cmd3 command three help + cmd4 command four help + +Ultimate Commands: + cmd5 command five help + cmd6 command six help + +one +three +six +EOF +unit_test cmdline_test 7 diff --git a/ctdb/tests/UNIT/cunit/comm_test_001.sh b/ctdb/tests/UNIT/cunit/comm_test_001.sh new file mode 100755 index 0000000..ac09f5c --- /dev/null +++ b/ctdb/tests/UNIT/cunit/comm_test_001.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + + +ok_null +unit_test comm_test 1 + +ok_null +unit_test comm_test 2 + +ok "100 2048 500 4096 1024 8192 200 16384 300 32768 400 65536 1048576 " +unit_test comm_test 3 diff --git a/ctdb/tests/UNIT/cunit/comm_test_002.sh b/ctdb/tests/UNIT/cunit/comm_test_002.sh new file mode 100755 index 0000000..a2fbf51 --- /dev/null +++ b/ctdb/tests/UNIT/cunit/comm_test_002.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +socket="${CTDB_TEST_TMP_DIR}/test_sock.$$" +num_clients=10 + +remove_socket () +{ + rm -f "$socket" +} + +test_cleanup remove_socket + +ok_null + +unit_test comm_server_test "$socket" $num_clients & +pid=$! + +for i in $(seq 1 $num_clients) ; do + unit_test comm_client_test "$socket" +done + +wait $pid diff --git a/ctdb/tests/UNIT/cunit/conf_test_001.sh b/ctdb/tests/UNIT/cunit/conf_test_001.sh new file mode 100755 index 0000000..188964e --- /dev/null +++ b/ctdb/tests/UNIT/cunit/conf_test_001.sh @@ -0,0 +1,196 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +conffile="${CTDB_TEST_TMP_DIR}/config.$$" + +remove_files () +{ + rm -f "$conffile" +} + +test_cleanup remove_files + +ok_null +unit_test conf_test 1 + +ok < "$conffile" < "$conffile" < "$conffile" < "key1" +[section1] + # key1 = value1 + # key2 = 10 + key3 = false # temporary +EOF +unit_test conf_test 9 "$conffile" + +cat > "$conffile" < "key3" +[section1] + # key1 = value1 + # key2 = 10 + key3 = false # temporary +EOF +unit_test conf_test 9 "$conffile" + +cat > "$conffile" < "$conffile" < "$conffile" < "$conffile" < "foo" +[section1] + # key1 = value1 + # key2 = 10 + key3 = false # temporary +EOF +unit_test conf_test 10 "$conffile" + +cat > "$conffile" < "$conffile" < "${conffile}.reload" < "$conffile" < "$conffile" < "$conffile" < "key" not defined +EOF +unit_test ctdb-config get section key + +# Confirm that an unknown key doesn't stop the rest of the file from +# loading +cat > "$conffile" < "unknown key" +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +ok < "$conffile" < "$conffile" < "$conffile" < "$conffile" < "$conffile" < "$conffile" < "$conffile" < "$conffile" < transport = invalid +conf: validation for option "transport" failed +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +cat > "$conffile" < "$conffile" < "$conffile" < node address = 10.1.2.3:123 +conf: validation for option "node address" failed +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +cat > "$conffile" < "$conffile" < recovery lock is deprecated +EOF +unit_test ctdb-config -d WARNING validate + +cat > "$conffile" < "$conffile" < leader timeout = 0 +conf: validation for option "leader timeout" failed +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +cat > "$conffile" < "leader timeout" = "-5" +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +cat > "$conffile" < "$conffile" < "$conffile" < "$conffile" < "$conffile" < script log level = INVALID +conf: validation for option "script log level" failed +Failed to load config file ${conffile} +EOF +unit_test ctdb-config validate diff --git a/ctdb/tests/UNIT/cunit/config_test_007.sh b/ctdb/tests/UNIT/cunit/config_test_007.sh new file mode 100755 index 0000000..8804448 --- /dev/null +++ b/ctdb/tests/UNIT/cunit/config_test_007.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +PATH="$PATH:$CTDB_SCRIPTS_HELPER_BINDIR" + +setup_ctdb_base "${CTDB_TEST_TMP_DIR}" "ctdb-etc" + +conffile="${CTDB_BASE}/ctdb.conf" + +remove_files () +{ + rm -f "$conffile" +} + +test_cleanup remove_files + +cat > "$conffile" < "$tfile" + +ok_null +unit_test line_test "$tfile" + +printf "\0" > "$tfile" + +required_result 1 < "$tfile" + +ok_null +unit_test line_test "$tfile" + +cat < "$tfile" +hello +world +EOF + +required_result 2 << EOF +hello +world +EOF +unit_test line_test "$tfile" + +required_result 2 << EOF +hello +world +EOF +unit_test line_test "$tfile" + +cat < "$tfile" +This is a really long long line full of random words and hopefully it will be read properly by the line test program and identified as a single line +EOF + +required_result 1 < "$tfile" +line number one +line number two +line number one +line number two +line number one +EOF + +required_result 5 < "$tfile" +this is line number one +this is line number two +this is line number three +this is line number four +this is line number five +EOF + +required_result 5 < "$scriptdir/prog" < "$scriptdir/11.foo.script" < "$scriptdir/22.bar.script" < "$scriptdir/22.bar.script" < "$prog" < "$prog" < "$prog" <"$output" 2>&1 +echo hello +EOF + +ok < "$prog" < "$prog" < "$prog" < "$prog" < "$pidfile" +sleep 10 +EOF + +ok < "$prog" < "$output" <"$tfile" +chmod a-r "$tfile" +uid=$(id -u) +# root can read unreadable files +if [ "$uid" = 0 ]; then + ok_tunable_defaults +else + required_error EINVAL <"$tfile" +required_error EINVAL <"$tfile" +required_error EINVAL <"$tfile" +required_error EINVAL <"$tfile" +required_error EINVAL <"$tfile" +required_error EINVAL <"$tfile" +required_error EINVAL <"$tfile" +required_error EINVAL <"$tfile" <"$tfile" <"$tfile" +ok_tunable_defaults +unit_test tunable_test "$tfile" + +test_case "OK, comments and blanks only" +cat >"$tfile" <"$tfile" <"$tfile" <"$tfile" <"$tfile" <"$tfile" <"$tfile" <"$tfile" < "$log" + ;; + +"verbosetimeout") + (ctdb-event status random $2) > "$log" + ;; + +"verbosetimeout2") + exec > "$log" 2>&1 + ctdb-event status random $2 + ;; + +*) + ;; + +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/data/03.notalink.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/data/03.notalink.script new file mode 100644 index 0000000..039e4d0 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/data/03.notalink.script @@ -0,0 +1,2 @@ +#!/bin/sh +exit 0 diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/data/README b/ctdb/tests/UNIT/eventd/etc-ctdb/events/data/README new file mode 100644 index 0000000..f38a189 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/data/README @@ -0,0 +1 @@ +initially empty event scripts directory diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/empty/README b/ctdb/tests/UNIT/eventd/etc-ctdb/events/empty/README new file mode 100644 index 0000000..a5614a9 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/empty/README @@ -0,0 +1 @@ +empty event scripts directory diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/01.test.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/01.test.script new file mode 100755 index 0000000..d16f0de --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/01.test.script @@ -0,0 +1,11 @@ +#!/bin/sh + +case "$1" in +"startup") sleep 5; exit 0 ;; +"monitor") sleep 5; exit 0 ;; +"event1") sleep 1; exit 0 ;; +"event2") sleep 1; exit 0 ;; +"event3") exit 3 ;; +"timeout1") sleep 99 ;; +*) exit 0 ;; +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/02.test.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/02.test.script new file mode 100755 index 0000000..5c841aa --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/02.test.script @@ -0,0 +1,9 @@ +#!/bin/sh + +case "$1" in +"monitor") sleep 1; exit 0 ;; +"event1") exit 1 ;; +"event2") sleep 1; exit 0 ;; +"timeout2") sleep 99 ;; +*) exit 0 ;; +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/03.test.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/03.test.script new file mode 100755 index 0000000..b48b68c --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/multi/03.test.script @@ -0,0 +1,9 @@ +#!/bin/sh + +case "$1" in +"monitor") sleep 1; exit 0 ;; +"event1") sleep 1; exit 0 ;; +"event2") exit 2 ;; +"timeout3") sleep 99 ;; +*) exit 0 ;; +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/01.disabled.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/01.disabled.script new file mode 100644 index 0000000..c52d3c2 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/01.disabled.script @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script new file mode 100755 index 0000000..f25e724 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in +"monitor") exit 0 ;; +"failure") exit 1 ;; +"timeout") sleep 99 ;; +"verbose") echo "Running event $1" ; exit 0 ;; +"verbosefailure") echo "args: $*"; exit 1 ;; +"verbosetimeout") echo "Sleeping for 99 seconds"; sleep 99 ;; +"verbosetimeout2") echo "Sleeping for 99 seconds"; sleep 99 ;; +*) exit 0 ;; +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/README.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/README.script new file mode 100644 index 0000000..9086add --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/README.script @@ -0,0 +1 @@ +Random collection of files and event scripts diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/a.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/a.script new file mode 100755 index 0000000..2bb8d86 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/a.script @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 1 diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/01.dummy.script b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/01.dummy.script new file mode 100755 index 0000000..9c56f5b --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/01.dummy.script @@ -0,0 +1,6 @@ +#!/bin/sh + +case "$1" in +"failure") exit 1 ;; +*) exit 0 ;; +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/02.disabled.script b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/02.disabled.script new file mode 100755 index 0000000..9c56f5b --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/data/02.disabled.script @@ -0,0 +1,6 @@ +#!/bin/sh + +case "$1" in +"failure") exit 1 ;; +*) exit 0 ;; +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/empty/README b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/empty/README new file mode 100644 index 0000000..a5614a9 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/empty/README @@ -0,0 +1 @@ +empty event scripts directory diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/01.disabled.script b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/01.disabled.script new file mode 100644 index 0000000..c52d3c2 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/01.disabled.script @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 0 diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/02.enabled.script b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/02.enabled.script new file mode 100755 index 0000000..f25e724 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/02.enabled.script @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in +"monitor") exit 0 ;; +"failure") exit 1 ;; +"timeout") sleep 99 ;; +"verbose") echo "Running event $1" ; exit 0 ;; +"verbosefailure") echo "args: $*"; exit 1 ;; +"verbosetimeout") echo "Sleeping for 99 seconds"; sleep 99 ;; +"verbosetimeout2") echo "Sleeping for 99 seconds"; sleep 99 ;; +*) exit 0 ;; +esac diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/README.script b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/README.script new file mode 100644 index 0000000..9086add --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/README.script @@ -0,0 +1 @@ +Random collection of files and event scripts diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/a.script b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/a.script new file mode 100755 index 0000000..2bb8d86 --- /dev/null +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/share/events/random/a.script @@ -0,0 +1,3 @@ +#!/bin/sh + +exit 1 diff --git a/ctdb/tests/UNIT/eventd/eventd_001.sh b/ctdb/tests/UNIT/eventd/eventd_001.sh new file mode 100755 index 0000000..7d4ee9e --- /dev/null +++ b/ctdb/tests/UNIT/eventd/eventd_001.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "non-existent eventscript directory" + +setup_eventd + +required_error ENOENT </dev/null || echo) + if [ -n "$pid" ] ; then + kill $pid || true + fi +} + +setup_eventd () +{ + echo "Setting up eventd" + + $VALGRIND ctdb-eventd 2>&1 | tee "$eventd_logfile" & + # Wait till eventd is running + wait_until 10 test -S "$eventd_socket" || \ + die "ctdb_eventd failed to start" + + test_cleanup cleanup_eventd +} + +simple_test_background () +{ + background_log="${CTDB_BASE}/background.log" + background_status="${CTDB_BASE}/background.status" + background_running=1 + + ( + (unit_test ctdb-event "$@") > "$background_log" 2>&1 + echo $? > "$background_status" + ) & + background_pid=$! +} + +background_wait () +{ + [ -n "$background_running" ] || return + + count=0 + while [ ! -s "$background_status" -a $count -lt 30 ] ; do + count=$(( $count + 1 )) + sleep 1 + done + + if [ ! -s "$background_status" ] ; then + kill -9 "$background_pid" + echo TIMEOUT > "$background_status" + fi +} + +background_output () +{ + [ -n "$background_running" ] || return + + bg_status=$(cat "$background_status") + rm -f "$background_status" + echo "--- Background ---" + if [ "$bg_status" = "TIMEOUT" ] ; then + echo "Background process did not complete" + bg_status=1 + else + cat "$background_log" + rm -f "$background_log" + fi + echo "--- Background ---" + unset background_running + [ $bg_status -eq 0 ] || exit $bg_status +} + +simple_test () +{ + (unit_test ctdb-event "$@") + status=$? + + background_wait + background_output + + [ $status -eq 0 ] || exit $status +} + +result_filter () +{ + _duration="\<[0-9][0-9]*\.[0-9][0-9][0-9]\>" + _day="[FMSTW][aehoru][deintu]" + _month="[ADFJMNOS][aceopu][bcglnprtvy]" + _date="[ 0-9][0-9]" + _time="[0-9][0-9]:[0-9][0-9]:[0-9][0-9]" + _year="[0-9][0-9][0-9][0-9]" + _datetime="${_day} ${_month} ${_date} ${_time} ${_year}" + _pid="[0-9][0-9]*" + sed -e "s#${_duration}#DURATION#" \ + -e "s#${_datetime}#DATETIME#" \ + -e "s#,${_pid}#,PID#" +} diff --git a/ctdb/tests/UNIT/eventscripts/00.ctdb.init.001.sh b/ctdb/tests/UNIT/eventscripts/00.ctdb.init.001.sh new file mode 100755 index 0000000..807f3ef --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/00.ctdb.init.001.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "TDB check, tdbtool supports check" + +setup + +FAKE_TDBTOOL_SUPPORTS_CHECK="yes" + +ok_null + +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/00.ctdb.init.002.sh b/ctdb/tests/UNIT/eventscripts/00.ctdb.init.002.sh new file mode 100755 index 0000000..7ff5385 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/00.ctdb.init.002.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "TDB check, tdbtool does no support check" + +setup + +FAKE_TDBTOOL_SUPPORTS_CHECK="no" + +ok <= threshold 90% +EOF +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.002.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.002.sh new file mode 100755 index 0000000..4e78a56 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.002.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Filesystem use check, good situation, 1 error check enabled" + +setup + +setup_script_options <= threshold 80% +EOF +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.004.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.004.sh new file mode 100755 index 0000000..3400393 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.004.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Filesystem use check, warn situation, only error check enabled" + +setup + +setup_script_options <= threshold 80% +EOF +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.006.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.006.sh new file mode 100755 index 0000000..48008d9 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.006.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Filesystem use check, error situation, both checks enabled" + +setup + +setup_script_options <= threshold 90% +EOF +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.007.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.007.sh new file mode 100755 index 0000000..68b99cf --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.007.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Filesystem use check, good situation, both checks enabled, multiple filesystems" + +setup + +setup_script_options <= threshold 80% +EOF +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.012.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.012.sh new file mode 100755 index 0000000..9e84056 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.012.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Memory check (custom, both), good situation" + +setup + +setup_script_options <= threshold 85% +EOF + +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.015.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.015.sh new file mode 100755 index 0000000..76b73a3 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.015.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Memory check (custom, error only), error situation" + +setup + +setup_script_options <= threshold 85% +$FAKE_PROC_MEMINFO +$(ps auxfww) +EOF + +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.017.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.017.sh new file mode 100755 index 0000000..b2e5029 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.017.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Memory check (custom, both), error situation" + +setup + +setup_script_options <= threshold 80% +$FAKE_PROC_MEMINFO +$(ps auxfww) +EOF + +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/05.system.monitor.018.sh b/ctdb/tests/UNIT/eventscripts/05.system.monitor.018.sh new file mode 100755 index 0000000..427adc6 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/05.system.monitor.018.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Memory check (custom, both), check throttling of warnings" + +setup + +setup_script_options <= threshold 70%" +simple_test + +# 2nd time at same level, nothing logged +set_mem_usage 71 71 +ok_null +simple_test + +set_mem_usage 73 73 +ok "WARNING: System memory utilization 73% >= threshold 70%" +simple_test + +# 2nd time at same level, nothing logged +set_mem_usage 73 73 +ok_null +simple_test + +set_mem_usage 79 79 +ok "WARNING: System memory utilization 79% >= threshold 70%" +simple_test + +set_mem_usage 80 80 +required_result 1 <= threshold 80% +$FAKE_PROC_MEMINFO +$(ps auxfww) +EOF +simple_test + +# Fall back into warning at same level as last warning... should log +set_mem_usage 79 79 +ok "WARNING: System memory utilization 79% >= threshold 70%" +simple_test + +# Below threshold, notice +set_mem_usage 69 69 +ok <= threshold 70%" +simple_test + +# Back up above critical threshold... unhealthy +set_mem_usage 81 81 +required_result 1 <= threshold 80% +$FAKE_PROC_MEMINFO +$(ps auxfww) +EOF +simple_test + +# Straight back down to a good level... notice +set_mem_usage 65 65 +ok "NOTICE: System memory utilization 65% < threshold 70%" +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.001.sh b/ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.001.sh new file mode 100755 index 0000000..0546863 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.001.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "callout succeeds" + +setup + +setup_nfs_callout + +ok_null +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.002.sh b/ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.002.sh new file mode 100755 index 0000000..dc44d2d --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/06.nfs.releaseip.002.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "callout causes releaseip-pre to fail" + +setup + +setup_nfs_callout "releaseip-pre" + +required_result 1 "releaseip-pre" +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/06.nfs.takeip.001.sh b/ctdb/tests/UNIT/eventscripts/06.nfs.takeip.001.sh new file mode 100755 index 0000000..0546863 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/06.nfs.takeip.001.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "callout succeeds" + +setup + +setup_nfs_callout + +ok_null +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/06.nfs.takeip.002.sh b/ctdb/tests/UNIT/eventscripts/06.nfs.takeip.002.sh new file mode 100755 index 0000000..c9f3db9 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/06.nfs.takeip.002.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "callout causes takeip-pre to fail" + +setup + +setup_nfs_callout "takeip-pre" + +required_result 1 "takeip-pre" +simple_test diff --git a/ctdb/tests/UNIT/eventscripts/10.interface.010.sh b/ctdb/tests/UNIT/eventscripts/10.interface.010.sh new file mode 100755 index 0000000..171a697 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/10.interface.010.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "Release 1 IP, 10 connections killed OK" + +setup + +ctdb_get_1_public_address | +while read dev ip bits ; do + ok_null + simple_test_event "takeip" $dev $ip $bits + + count=10 + setup_tcp_connections $count \ + "$ip" 445 10.254.254.0 12300 + + ok < reconfigure" + +setup + +public_address=$(ctdb_get_1_public_address) + +ok_null + +simple_test_event "takeip" $public_address + +ok < no reconfigure" + +setup + +public_address=$(ctdb_get_1_public_address) + +ok_null + +simple_test_event "takeip" $public_address + +ok_null + +simple_test_event "monitor" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.releaseip.001.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.releaseip.001.sh new file mode 100755 index 0000000..8bf0fa2 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.releaseip.001.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "callout is 'true'" + +setup + +setup_script_options < 127.0.0.1:0 Local 1 0 0 + -> 192.168.1.1:0 Route 1 0 0 + -> 192.168.1.2:0 Route 1 0 0 + -> 192.168.1.3:0 Route 1 0 0 +EOF + +ipvsadm -A -t 10.1.1.201 -s lc -p 1999999 +ipvsadm -a -t 10.1.1.201 -r 192.168.1.3 -g +ipvsadm -a -t 10.1.1.201 -r 192.168.1.1 -g +ipvsadm -a -t 10.1.1.201 -r 192.168.1.2:0 -g + +check_ipvsadm < 192.168.1.1:0 Route 1 0 0 + -> 192.168.1.2:0 Route 1 0 0 + -> 192.168.1.3:0 Route 1 0 0 +UDP 10.1.1.201:0 lc persistent 1999999 + -> 127.0.0.1:0 Local 1 0 0 + -> 192.168.1.1:0 Route 1 0 0 + -> 192.168.1.2:0 Route 1 0 0 + -> 192.168.1.3:0 Route 1 0 0 +EOF + +ipvsadm -D -u 10.1.1.201 + +check_ipvsadm < 192.168.1.1:0 Route 1 0 0 + -> 192.168.1.2:0 Route 1 0 0 + -> 192.168.1.3:0 Route 1 0 0 +EOF + +ipvsadm -D -t 10.1.1.201 + +check_ipvsadm NULL diff --git a/ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.011.sh b/ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.011.sh new file mode 100755 index 0000000..6866047 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/91.lvs.ipreallocated.011.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "configured, no nodes in config" + +setup "10.1.1.201" "eth0" < 127.0.0.1:0 Local 1 0 0 + -> 192.168.1.2:0 Route 1 0 0 + -> 192.168.1.3:0 Route 1 0 0 +UDP 10.1.1.201:0 lc persistent 1999999 + -> 127.0.0.1:0 Local 1 0 0 + -> 192.168.1.2:0 Route 1 0 0 + -> 192.168.1.3:0 Route 1 0 0 +EOF + +check_lvs_ip global diff --git a/ctdb/tests/UNIT/eventscripts/91.lvs.monitor.001.sh b/ctdb/tests/UNIT/eventscripts/91.lvs.monitor.001.sh new file mode 100755 index 0000000..42831fb --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/91.lvs.monitor.001.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "not configured" + +setup <..NNN.sh + +The test helper functions will run with specified +options. If using the simple_test() helper function then the 1st + argument is automatically passed. When simple_test_event() is +used the event name must be explicitly passed as the 1st argument - +this is more flexible and supports multiple events per test. + +Examples: + +* ../run_tests.sh . + + Run all tests, displaying minimal output. + +* ../run_tests.sh -s . + + Run all tests, displaying minimal output and a summary. + +* ../run_tests.sh -s ./10.interface.*.sh + + Run all the tests against the 10.interface eventscript. + +* ../run_tests.sh -v -s . + + Run all tests, displaying extra output and a summary. + +* ../run_tests.sh -sq . + + Run all tests, displaying only a summary. + +* ../run_tests.sh -X ./10.interface.startup.002.sh + + Run a test and have the eventscript itself run with "sh -x". This + will usually make a test fail because the (undesirable) trace output + will be included with the output of the eventscript. However, this + is useful for finding out why a test might be failing. diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.001.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.001.sh new file mode 100755 index 0000000..8f10200 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.001.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB S+ DB" + +setup + +do_test "DB" "S+" "DB" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.002.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.002.sh new file mode 100755 index 0000000..31ae3df --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.002.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB D. DB" + +setup + +do_test "DB" "D." "DB" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.003.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.003.sh new file mode 100755 index 0000000..89ab2f1 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.003.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD S+ DB" + +setup + +do_test "RECORD" "S+" "DB" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.004.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.004.sh new file mode 100755 index 0000000..35500cb --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.004.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD D. DB" + +setup + +do_test "RECORD" "D." "DB" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.005.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.005.sh new file mode 100755 index 0000000..10cbade --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.005.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB S+ RECORD" + +setup + +do_test "DB" "S+" "RECORD" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.006.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.006.sh new file mode 100755 index 0000000..c4988b7 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.006.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB D. RECORD" + +setup + +do_test "DB" "D." "RECORD" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.007.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.007.sh new file mode 100755 index 0000000..b186d20 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.007.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD S+ RECORD" + +setup + +do_test "RECORD" "S+" "RECORD" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.008.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.008.sh new file mode 100755 index 0000000..7b7ac9b --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.008.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD D. RECORD" + +setup + +do_test "RECORD" "D." "RECORD" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.021.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.021.sh new file mode 100755 index 0000000..f324803 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.021.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB S+ DB MUTEX" + +setup + +do_test "DB" "S+" "DB" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.022.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.022.sh new file mode 100755 index 0000000..0e70771 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.022.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB D. DB MUTEX" + +setup + +do_test "DB" "D." "DB" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.023.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.023.sh new file mode 100755 index 0000000..de84c81 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.023.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD S+ DB MUTEX" + +setup + +do_test "RECORD" "S+" "DB" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.024.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.024.sh new file mode 100755 index 0000000..30ad6bd --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.024.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD D. DB MUTEX" + +setup + +do_test "RECORD" "D." "DB" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.025.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.025.sh new file mode 100755 index 0000000..f259db5 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.025.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB S+ RECORD MUTEX" + +setup + +do_test "DB" "S+" "RECORD" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.026.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.026.sh new file mode 100755 index 0000000..9e057af --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.026.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "DB D. RECORD MUTEX" + +setup + +do_test "DB" "D." "RECORD" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.027.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.027.sh new file mode 100755 index 0000000..d70e7b7 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.027.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD S+ RECORD MUTEX" + +setup + +do_test "RECORD" "S+" "RECORD" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/debug_locks.sh.028.sh b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.028.sh new file mode 100755 index 0000000..7199035 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/debug_locks.sh.028.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "RECORD D. RECORD MUTEX" + +setup + +do_test "RECORD" "D." "RECORD" "MUTEX" diff --git a/ctdb/tests/UNIT/eventscripts/etc-ctdb/public_addresses b/ctdb/tests/UNIT/eventscripts/etc-ctdb/public_addresses new file mode 100644 index 0000000..cd2f6be --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/etc-ctdb/public_addresses @@ -0,0 +1,9 @@ +10.0.0.1/24 dev123 +10.0.0.2/24 dev123 +10.0.0.3/24 dev123 +10.0.0.4/24 dev123 +10.0.0.5/24 dev123 +10.0.0.6/24 dev123 +10.0.1.1/24 dev456 +10.0.1.2/24 dev456 +10.0.1.3/24 dev456 diff --git a/ctdb/tests/UNIT/eventscripts/etc-ctdb/rc.local b/ctdb/tests/UNIT/eventscripts/etc-ctdb/rc.local new file mode 100755 index 0000000..2f506e9 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/etc-ctdb/rc.local @@ -0,0 +1,59 @@ +# Hey Emacs, this is a -*- shell-script -*- !!! :-) + +# Always use stub version of service command +service () +{ + "${CTDB_HELPER_BINDIR}/service" "$@" +} + +nice_service () +{ + nice "${CTDB_HELPER_BINDIR}/service" "$@" +} + +# Always succeeds +set_proc () { : ; } +set_proc_maybe () { : ; } + +get_proc () +{ + case "$1" in + net/bonding/*) + cat "$FAKE_PROC_NET_BONDING/${1##*/}" + ;; + sys/net/ipv4/conf/all/arp_filter) + echo 1 + ;; + sys/net/ipv4/conf/all/promote_secondaries) + echo 1 + ;; + fs/nfsd/threads) + echo "$FAKE_NFSD_THREAD_PIDS" | wc -w + ;; + */stack) + echo "[] fake_stack_trace_for_pid_${1}+0x0/0xff" + ;; + meminfo) + echo "$FAKE_PROC_MEMINFO" + ;; + locks) + echo "$FAKE_PROC_LOCKS" + ;; + *) + echo "get_proc: \"$1\" not implemented" + exit 1 + esac +} + +# Do not actually background - we want to see the output +background_with_logging () +{ + "$@" 2>&1 "${CTDB_BASE}/ctdb.tunables" +} + +result_filter () +{ + _date="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" + _time="[0-9][0-9][0-9][0-9][0-9][0-9]" + _date_time="${_date}\.${_time}" + sed -e "s|\.${_date_time}\.|.DATE.TIME.|" +} diff --git a/ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh b/ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh new file mode 100644 index 0000000..cc1f086 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh @@ -0,0 +1,16 @@ +setup () +{ + if [ $# -eq 1 ] ; then + reclock="$1" + else + reclock="${CTDB_TEST_TMP_DIR}/reclock_subdir/rec.lock" + fi + CTDB_RECOVERY_LOCK="$reclock" + + if [ -n "$CTDB_RECOVERY_LOCK" ] ; then + cat >>"${CTDB_BASE}/ctdb.conf" <"$FAKE_NETSTAT_TCP_ESTABLISHED_FILE" +} + +setup_tcp_connections_unkillable () +{ + # These connections are listed by the "ss" stub but are not + # killed by the "ctdb killtcp" stub. So killing these + # connections will never succeed... and will look like a time + # out. + _t=$(_tcp_connections "$@" | sed -e 's/ /|/g') + export FAKE_NETSTAT_TCP_ESTABLISHED="$_t" +} + +# Setup some fake /proc/net/bonding files with just enough info for +# the eventscripts. + +# arg1 is interface name, arg2 is currently active slave (use "None" +# if none), arg3 is MII status ("up" or "down"). +setup_bond () +{ + _iface="$1" + _slave="${2:-${_iface}_sl_0}" + _mii_s="${3:-up}" + _mii_subs="${4:-${_mii_s:-up}}" + + cat <"${FAKE_PROC_NET_BONDING}/$_iface" <"$natgw_nodes" + + # Assume all of the nodes are on a /24 network and have IPv4 + # addresses: + read _ip <"$natgw_nodes" + + setup_script_options < mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether ${_mac} brd ff:ff:ff:ff:ff:ff + inet ${CTDB_NATGW_PUBLIC_IP} brd ${_brd} scope global ${CTDB_NATGW_PUBLIC_IFACE} + valid_lft forever preferred_lft forever +EOF +} + +ok_natgw_follower_ip_addr_show () +{ + _mac=$(echo "$CTDB_NATGW_PUBLIC_IFACE" | + cksum | + sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@') + + ok < mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether ${_mac} brd ff:ff:ff:ff:ff:ff +EOF +} + +ok_natgw_leader_static_routes () +{ + _nl=" +" + _t="" + for _i in $CTDB_NATGW_STATIC_ROUTES ; do + # This is intentionally different to the code in 11.natgw ;-) + case "$_i" in + *@*) + _net=$(echo "$_i" | sed -e 's|@.*||') + _gw=$(echo "$_i" | sed -e 's|.*@||') + ;; + *) + _net="$_i" + _gw="$CTDB_NATGW_DEFAULT_GATEWAY" + esac + + [ -n "$_gw" ] || continue + _t="${_t}${_t:+${_nl}}" + _t="${_t}${_net} via ${_gw} dev ethXXX metric 10 " + done + _t=$(echo "$_t" | sort) + ok "$_t" +} + +ok_natgw_follower_static_routes () +{ + _nl=" +" + _t="" + for _i in $CTDB_NATGW_STATIC_ROUTES ; do + # This is intentionally different to the code in 11.natgw ;-) + _net=$(echo "$_i" | sed -e 's|@.*||') + + # The interface for the private network isn't + # specified as part of the NATGW configuration and + # isn't part of the command to add the route. It is + # implicitly added by "ip route" but our stub doesn't + # do this and adds "ethXXX". + _t="${_t}${_t:+${_nl}}" + _t="${_t}${_net} via ${FAKE_CTDB_NATGW_LEADER} dev ethXXX metric 10 " + done + _t=$(echo "$_t" | sort) + ok "$_t" +} diff --git a/ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh b/ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh new file mode 100644 index 0000000..e57e91a --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh @@ -0,0 +1,42 @@ +setup () +{ + setup_public_addresses + + service_name="per_ip_routing" + + setup_script_options <, all), defaulting to +# 1. If $2 is "default" then a default route is also added. +create_policy_routing_config () +{ + _num_ips="${1:-1}" + _should_add_default="$2" + + ctdb_get_my_public_addresses | + if [ "$_num_ips" = "all" ] ; then + cat + else + { head -n "$_num_ips" ; cat >/dev/null ; } + fi | + while read _dev _ip _bits ; do + _net=$(ipv4_host_addr_to_net "$_ip" "$_bits") + _gw="${_net%.*}.254" # a dumb, calculated default + + echo "$_ip $_net" + + if [ "$_should_add_default" = "default" ] ; then + echo "$_ip 0.0.0.0/0 $_gw" + fi + done >"$CTDB_PER_IP_ROUTING_CONF" +} diff --git a/ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh b/ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh new file mode 100644 index 0000000..2a69ae8 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh @@ -0,0 +1,24 @@ +setup () +{ + _failures="" + _devices="" + for i ; do + case "$i" in + \!*) + _t="${i#!}" + echo "Marking ${_t} as having no active paths" + _failures="${_failures}${_failures:+ }${_t}" + ;; + *) + _t="$i" + esac + _devices="${_devices}${_devices:+ }${_t}" + done + + setup_script_options <"$_threads" + export FAKE_NFSD_THREAD_PIDS="$*" + ;; + *) + export FAKE_RPC_THREAD_PIDS="$*" + ;; + esac +} + +guess_output () +{ + case "$1" in + $CTDB_NFS_CALLOUT\ start\ nlockmgr) + case "$CTDB_NFS_DISTRO_STYLE" in + sysvinit-redhat) + echo "&Starting nfslock: OK" + ;; + sysvinit-debian) + cat </dev/null; then + echo "Stopping quotarpc: OK" + else + echo "service: can't stop quotarpc - not running" + fi + ;; + esac + ;; + $CTDB_NFS_CALLOUT\ stop\ status) + case "$CTDB_NFS_DISTRO_STYLE" in + systemd-*) + echo "Stopping rpc-statd: OK" + ;; + esac + ;; + $CTDB_NFS_CALLOUT\ start\ mountd) + case "$CTDB_NFS_DISTRO_STYLE" in + systemd-*) + echo "&Starting nfs-mountd: OK" + ;; + esac + ;; + $CTDB_NFS_CALLOUT\ start\ rquotad) + case "$CTDB_NFS_DISTRO_STYLE" in + systemd-redhat) + echo "&Starting rpc-rquotad: OK" + ;; + systemd-debian) + echo "&Starting quotarpc: OK" + ;; + esac + ;; + $CTDB_NFS_CALLOUT\ start\ status) + case "$CTDB_NFS_DISTRO_STYLE" in + systemd-*) + echo "&Starting rpc-statd: OK" + ;; + esac + ;; + *) + : # Nothing + esac +} + +# Set the required result for a particular RPC program having failed +# for a certain number of iterations. This is probably still a work +# in progress. Note that we could hook aggressively +# nfs_check_rpc_service() to try to implement this but we're better +# off testing nfs_check_rpc_service() using independent code... even +# if it is incomplete and hacky. So, if the 60.nfs eventscript +# changes and the tests start to fail then it may be due to this +# function being incomplete. +rpc_set_service_failure_response () +{ + _rpc_service="$1" + _numfails="${2:-1}" # default 1 + + # Default + ok_null + if [ $_numfails -eq 0 ] ; then + return + fi + + nfs_load_config + + # A handy newline. :-) + _nl=" +" + + _dir="${CTDB_NFS_CHECKS_DIR:-${CTDB_BASE}/nfs-checks.d}" + + _file=$(ls "$_dir"/[0-9][0-9]."${_rpc_service}.check") + [ -r "$_file" ] || \ + die "RPC check file \"$_file\" does not exist or is not unique" + + _out="${CTDB_TEST_TMP_DIR}/rpc_failure_output" + : >"$_out" + _rc_file="${CTDB_TEST_TMP_DIR}/rpc_result" + + ( + # Subshell to restrict scope variables... + + # Defaults + family="tcp" + version="" + unhealthy_after=1 + restart_every=0 + service_stop_cmd="" + service_start_cmd="" + service_check_cmd="" + service_debug_cmd="" + + # Don't bother syntax checking, eventscript does that... + . "$_file" + + # Just use the first version, or use default. This is + # dumb but handles all the cases that we care about + # now... + if [ -n "$version" ] ; then + _ver="${version%% *}" + else + case "$_rpc_service" in + portmapper) _ver="" ;; + *) _ver=1 ;; + esac + fi + _rpc_check_out="\ +$_rpc_service failed RPC check: +rpcinfo: RPC: Program not registered +program $_rpc_service${_ver:+ version }${_ver} is not available" + + if [ $unhealthy_after -gt 0 -a \ + $_numfails -ge $unhealthy_after ] ; then + _unhealthy=true + echo 1 >"$_rc_file" + echo "ERROR: ${_rpc_check_out}" >>"$_out" + else + _unhealthy=false + echo 0 >"$_rc_file" + fi + + if [ $restart_every -gt 0 ] && \ + [ $(($_numfails % $restart_every)) -eq 0 ] ; then + if ! $_unhealthy ; then + echo "WARNING: ${_rpc_check_out}" >>"$_out" + fi + + echo "Trying to restart service \"${_rpc_service}\"..."\ + >>"$_out" + + guess_output "$service_stop_cmd" >>"$_out" + + if [ -n "$service_debug_cmd" ] ; then + $service_debug_cmd 2>&1 >>"$_out" + fi + + guess_output "$service_start_cmd" >>"$_out" + fi + ) + + read _rc <"$_rc_file" + required_result $_rc <"$_out" + + rm -f "$_out" "$_rc_file" +} + +program_stack_traces () +{ + _prog="$1" + _max="${2:-1}" + + _count=1 + if [ "$_prog" = "nfsd" ] ; then + _pids="$FAKE_NFSD_THREAD_PIDS" + else + _pids="$FAKE_RPC_THREAD_PIDS" + fi + for _pid in $_pids ; do + [ $_count -le $_max ] || break + + program_stack_trace "$_prog" "$_pid" + _count=$(($_count + 1)) + done +} + +# Run an NFS eventscript iteratively. +# +# - 1st argument is the number of iterations. +# +# - 2nd argument is the NFS/RPC service being tested +# +# rpcinfo (or $service_check_cmd) is used on each iteration to test +# the availability of the service +# +# If this is not set or null then no RPC service is checked and the +# required output is not reset on each iteration. This is useful in +# baseline tests to confirm that the eventscript and test +# infrastructure is working correctly. +# +# - Subsequent arguments come in pairs: an iteration number and +# something to eval before that iteration. Each time an iteration +# number is matched the associated argument is given to eval after +# the default setup is done. The iteration numbers need to be given +# in ascending order. +# +# These arguments can allow a service to be started or stopped +# before a particular iteration. +# +nfs_iterate_test () +{ + _repeats="$1" + _rpc_service="$2" + if [ -n "$2" ] ; then + shift 2 + else + shift + fi + + echo "Running $_repeats iterations of \"$script $event\" $args" + + _iterate_failcount=0 + for _iteration in $(seq 1 $_repeats) ; do + # This is not a numerical comparison because $1 will + # often not be set. + if [ "$_iteration" = "$1" ] ; then + debug </dev/null 2>&1 ; then + _ok=true + fi + fi + + if $_ok ; then + _iterate_failcount=0 + else + _iterate_failcount=$(($_iterate_failcount + 1)) + fi + rpc_set_service_failure_response \ + "$_rpc_service" $_iterate_failcount + fi + _out=$(simple_test 2>&1) + _ret=$? + if "$CTDB_TEST_VERBOSE" || [ $_ret -ne 0 ] ; then + cat <"$CTDB_LVS_NODES" +} + +check_ipvsadm () +{ + if [ "$1" = "NULL" ] ; then + required_result 0 < mtu 65536 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +EOF + else + required_result 0 < mtu 65536 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet ${CTDB_LVS_PUBLIC_IP}/32 scope ${_scope} lo + valid_lft forever preferred_lft forever +EOF + fi + + simple_test_command ip addr show dev lo +} diff --git a/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh b/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh new file mode 100644 index 0000000..c303c60 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh @@ -0,0 +1,255 @@ +setup () +{ + setup_dbdir +} + +result_filter() +{ + sed -e 's|\( of debug locks PID=\)[0-9]*|\1PID|' +} + +tdb_path () +{ + echo "${CTDB_DBDIR}/${1}.${FAKE_CTDB_PNN}" +} + +fake_file_id () +{ + _path="$1" + + echo "$FAKE_FILE_ID_MAP" | + awk -v path="$_path" '$1 == path { print $2 }' +} + +fake_stack_trace () +{ + _pid="$1" + _command="${2:-smbd}" + _state="$3" + + echo "----- Stack trace for PID=${_pid} -----" + + case "$_state" in + D*) + cat <] fake_stack_trace_for_pid_${_pid}/stack+0x0/0xff +EOF + ;; + *) + cat <, argv=) at ${_command}.c +EOF + ;; + esac +} + +do_test () +{ + _holder_scope="$1" + _holder_state="$2" + _helper_scope="$3" + _lock_type="${4:-FCNTL}" + + _lock_helper_pid="4132032" + + FAKE_PS_MAP=$(cat < POSIX ADVISORY WRITE ${_lock_helper_pid} ${_locking_tdb_id} 168 170 +EOF + ) + elif [ "$_helper_scope" = "RECORD" ] && \ + [ "$_lock_type" = "FCNTL" ] ; then + _helper_lock=$(cat < POSIX ADVISORY WRITE ${_lock_helper_pid} ${_locking_tdb_id} 112736 112736 +EOF + ) + fi + _t=$(cat <&2 + else + cat >&2 + fi + } +else + debug () { : ; } +fi + +###################################################################### + +# General setup fakery + +# Default is to use script name with ".options" appended. With +# arguments, this can specify an alternate script name (and +# component). +setup_script_options () +{ + if [ $# -eq 2 ] ; then + _script="$2" + elif [ $# -eq 0 ] ; then + _script="" + else + die "usage: setup_script_options [ component script ]" + fi + + if [ -n "$_script" ] ; then + _options="${CTDB_BASE}/events/legacy/${_script}.options" + else + _options="${script_dir}/${script%.script}.options" + fi + + cat >>"$_options" + + # Source the options so that tests can use the variables + . "$_options" +} + +setup_dbdir () +{ + export CTDB_DBDIR_BASE="${CTDB_TEST_TMP_DIR}/db" + CTDB_DBDIR="${CTDB_DBDIR_BASE}/volatile" + CTDB_DBDIR_PERSISTENT="${CTDB_DBDIR_BASE}/persistent" + CTDB_DBDIR_STATE="${CTDB_DBDIR_BASE}/state" + cat >>"${CTDB_BASE}/ctdb.conf" <> 8)) + done + + echo "${_net}/${_maskbits}" +} + +###################################################################### + +# CTDB fakery + +setup_numnodes () +{ + export FAKE_CTDB_NUMNODES="${1:-3}" + echo "Setting up CTDB with ${FAKE_CTDB_NUMNODES} fake nodes" +} + +# For now this creates the same public addresses each time. However, +# it could be made more flexible. +setup_public_addresses () +{ + _f="${CTDB_BASE}/public_addresses" + + echo "Setting up public addresses in ${_f}" + cat >"$_f" < 1 {print $2}') +} + +ctdb_get_1_interface () +{ + _t=$(ctdb_get_interfaces) + echo ${_t%% *} +} + +# Print public addresses on this node as: interface IP maskbits +# Each line is suitable for passing to takeip/releaseip +ctdb_get_my_public_addresses () +{ + ctdb ip -v -X | { + read _x # skip header line + + while IFS="|" read _x _ip _x _iface _x ; do + [ -n "$_iface" ] || continue + while IFS="/$IFS" read _i _maskbits _x ; do + if [ "$_ip" = "$_i" ] ; then + echo $_iface $_ip $_maskbits + break + fi + done <"${CTDB_BASE}/public_addresses" + done + } +} + +# Prints the 1st public address as: interface IP maskbits +# This is suitable for passing to takeip/releaseip +ctdb_get_1_public_address () +{ + ctdb_get_my_public_addresses | { head -n 1 ; cat >/dev/null ; } +} + +# Check the routes against those that are expected. $1 is the number +# of assigned IPs to use (, all), defaulting to 1. If $2 is +# "default" then expect default routes to have been added. +check_routes () +{ + _num_ips="${1:-1}" + _should_add_default="$2" + + _policy_rules="" + _policy_routes="" + + ctdb_get_my_public_addresses | + if [ "$_num_ips" = "all" ] ; then + cat + else + { head -n "$_num_ips" ; cat >/dev/null ; } + fi | { + while read _dev _ip _bits ; do + _net=$(ipv4_host_addr_to_net "$_ip" "$_bits") + _gw="${_net%.*}.254" # a dumb, calculated default + + _policy_rules="${_policy_rules} +${CTDB_PER_IP_ROUTING_RULE_PREF}: from $_ip lookup ctdb.$_ip " + _policy_routes="${_policy_routes} +# ip route show table ctdb.$_ip +$_net dev $_dev scope link " + + if [ "$_should_add_default" = "default" ] ; then + _policy_routes="${_policy_routes} +default via $_gw dev $_dev " + fi + done + + ok <] fake_stack_trace_for_pid_${_pid}/stack+0x0/0xff +EOF +} + +###################################################################### + +# Result and test functions + + +############################################################ + +setup () +{ + die "setup() is not defined" +} + +# Set some globals and print the summary. +define_test () +{ + desc="$1" + + _f=$(basename "$0" ".sh") + + # Remaining format should be NN.script.event.NUM or + # NN.script.NUM or script.NUM: + _num="${_f##*.}" + _f="${_f%.*}" + + case "$_f" in + [0-9][0-9].*) + case "$_f" in + [0-9][0-9].*.*) + script="${_f%.*}.script" + event="${_f##*.}" + ;; + [0-9][0-9].*) + script="${_f}.script" + unset event + ;; + esac + # "Enable" the script + _subdir="events/legacy" + script_dir="${CTDB_BASE}/${_subdir}" + # Symlink target needs to be absolute + case "$CTDB_SCRIPTS_DATA_DIR" in + /*) _data_dir="${CTDB_SCRIPTS_DATA_DIR}/${_subdir}" ;; + *) _data_dir="${PWD}/${CTDB_SCRIPTS_DATA_DIR}/${_subdir}" + esac + mkdir -p "$script_dir" + ln -s "${_data_dir}/${script}" "$script_dir" + ;; + *) + script="${_f%.*}" + script="$_f" + unset event + script_dir="${CTDB_BASE}" + esac + + _s="${script_dir}/${script}" + [ -r "$_s" ] || \ + die "Internal error - unable to find script \"${_s}\"" + + case "$script" in + *.script) script_short="${script%.script}" ;; + *.sh) script_short="${script%.sh}" ;; + *) script_short="$script" ;; + esac + + printf "%-17s %-10s %-4s - %s\n\n" \ + "$script_short" "$event" "$_num" "$desc" + + _f="${CTDB_TEST_SUITE_DIR}/scripts/${script_short}.sh" + if [ -r "$_f" ] ; then + . "$_f" + fi + + ctdb_set_pnn 0 +} + +# Run an eventscript once. The test passes if the return code and +# output match those required. + +# Any args are passed to the eventscript. + +simple_test () +{ + [ -n "$event" ] || die 'simple_test: $event not set' + + args="$@" + + test_header () + { + echo "Running script \"$script $event${args:+ }$args\"" + } + + extra_header () + { + cat < ${_cip}, MON_NAME=${_sip}, STATE=${_state_even} +SM_NOTIFY: ${_sip} -> ${_cip}, MON_NAME=${NFS_HOSTNAME}, STATE=${_state_even} +SM_NOTIFY: ${_sip} -> ${_cip}, MON_NAME=${_sip}, STATE=${_state_odd} +SM_NOTIFY: ${_sip} -> ${_cip}, MON_NAME=${NFS_HOSTNAME}, STATE=${_state_odd} +EOF + done + done | { + ok + simple_test_event "notify" + } || exit $? +} diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.001.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.001.sh new file mode 100755 index 0000000..7293390 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/statd-callout.001.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "single add-client" + +setup + +ok_null +simple_test_event "add-client" "192.168.123.45" +simple_test_event "update" + +check_ctdb_tdb_statd_state "192.168.123.45" diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.002.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.002.sh new file mode 100755 index 0000000..ce9f139 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/statd-callout.002.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "2 x add-client, update" + +setup + +ok_null +simple_test_event "add-client" "192.168.123.45" +simple_test_event "add-client" "192.168.123.46" +simple_test_event "update" + +check_ctdb_tdb_statd_state "192.168.123.45" "192.168.123.46" diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.003.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.003.sh new file mode 100755 index 0000000..25bec29 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/statd-callout.003.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "add-client, update, del-client, update" + +setup + +ok_null +simple_test_event "add-client" "192.168.123.45" +simple_test_event "update" + +simple_test_event "del-client" "192.168.123.45" +simple_test_event "update" + +check_ctdb_tdb_statd_state diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.004.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.004.sh new file mode 100755 index 0000000..dc2156b --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/statd-callout.004.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "single add-client, notify" + +setup + +ok_null +simple_test_event "add-client" "192.168.123.45" +simple_test_event "update" + +check_ctdb_tdb_statd_state "192.168.123.45" + +check_statd_callout_smnotify "192.168.123.45" + +check_ctdb_tdb_statd_state diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.005.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.005.sh new file mode 100755 index 0000000..1f802a2 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/statd-callout.005.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "2 x add-client to different nodes, notify on 1" + +setup + +ok_null +simple_test_event "add-client" "192.168.123.45" +simple_test_event "update" + +ctdb_set_pnn 1 + +ok_null +simple_test_event "add-client" "192.168.123.46" +simple_test_event "update" + +ctdb_set_pnn 0 + +check_statd_callout_smnotify "192.168.123.45" + +ctdb_set_pnn 1 + +check_ctdb_tdb_statd_state "192.168.123.46" diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.006.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.006.sh new file mode 100755 index 0000000..8ecba5c --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/statd-callout.006.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "2 x add-client to different nodes, notify on both" + +setup + +ok_null +simple_test_event "add-client" "192.168.123.45" +simple_test_event "update" + +ctdb_set_pnn 1 + +ok_null +simple_test_event "add-client" "192.168.123.46" +simple_test_event "update" + +ctdb_set_pnn 0 + +check_statd_callout_smnotify "192.168.123.45" + +ctdb_set_pnn 1 + +check_statd_callout_smnotify "192.168.123.46" + +check_ctdb_tdb_statd_state diff --git a/ctdb/tests/UNIT/eventscripts/statd-callout.007.sh b/ctdb/tests/UNIT/eventscripts/statd-callout.007.sh new file mode 100755 index 0000000..4445fff --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/statd-callout.007.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "add-client, del-client, update" + +setup + +ok_null +simple_test_event "add-client" "192.168.123.45" +simple_test_event "del-client" "192.168.123.45" +simple_test_event "update" + +check_ctdb_tdb_statd_state diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb b/ctdb/tests/UNIT/eventscripts/stubs/ctdb new file mode 100755 index 0000000..fc7bd4f --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb @@ -0,0 +1,496 @@ +#!/bin/sh + +prog="ctdb" + +# Print a message and exit. +die () +{ + echo "$1" >&2 ; exit ${2:-1} +} + +not_implemented_exit_code=1 + +usage () +{ + cat >&2 <&2 + exit $not_implemented_exit_code +} + +verbose=false +machine_readable=false +nodespec="" + +args="" + +# Options and command argument can appear in any order, so when +# getopts thinks it is done, process any non-option arguments and go +# around again. +while [ $# -gt 0 ] ; do + while getopts "Xvhn:?" opt ; do + case "$opt" in + X) machine_readable=true ;; + v) verbose=true ;; + n) nodespec="$OPTARG" ;; + \?|*) usage ;; + esac + done + shift $((OPTIND - 1)) + + # Anything left over must be a non-option arg + if [ $# -gt 0 ] ; then + args="${args}${args:+ }${1}" + shift + fi +done + +[ -n "$args" ] || usage +set -- $args + +setup_tickles () +{ + # Make sure tickles file exists. + tickles_file="${CTDB_TEST_TMP_DIR}/fake-ctdb/tickles" + mkdir -p $(dirname "$tickles_file") + touch "$tickles_file" +} + +ctdb_gettickles () +{ + _ip="$1" + _port="$2" + + setup_tickles + + echo "|source ip|port|destination ip|port|" + while read _src _dst ; do + if [ -z "$_ip" -o "$_ip" = "${_dst%:*}" ] ; then + if [ -z "$_port" -o "$_port" = "${_dst##*:}" ] ; then + echo "|${_src%:*}|${_src##*:}|${_dst%:*}|${_dst##*:}|" + fi + fi + done <"$tickles_file" +} + +ctdb_addtickle () +{ + _src="$1" + _dst="$2" + + setup_tickles + + if [ -n "$_dst" ] ; then + echo "${_src} ${_dst}" >>"$tickles_file" + else + cat >>"$tickles_file" + fi +} + +ctdb_deltickle () +{ + _src="$1" + _dst="$2" + + setup_tickles + + if [ -n "$_dst" ] ; then + _t=$(grep -F -v "${_src} $${_dst}" "$tickles_file") + else + _t=$(cat "$tickles_file") + while read _src _dst ; do + _t=$(echo "$_t" | grep -F -v "${_src} ${_dst}") + done + fi + echo "$_t" >"$tickles_file" +} + +parse_nodespec () +{ + if [ "$nodespec" = "all" ] ; then + nodes="$(seq 0 $((FAKE_CTDB_NUMNODES - 1)) )" + elif [ -n "$nodespec" ] ; then + nodes="$(echo $nodespec | sed -e 's@,@ @g')" + else + node=$(ctdb_pnn) + fi +} + +# For testing backward compatibility... +for i in $CTDB_NOT_IMPLEMENTED ; do + if [ "$i" = "$1" ] ; then + not_implemented "$i" + fi +done + +ctdb_pnn () +{ + # Defaults to 0 + echo "${FAKE_CTDB_PNN:-0}" +} + +###################################################################### + +FAKE_CTDB_NODE_STATE="$FAKE_CTDB_STATE/node-state" +FAKE_CTDB_NODES_DISABLED="$FAKE_CTDB_NODE_STATE/0x4" + +###################################################################### + +# NOTE: all nodes share public addresses file + +FAKE_CTDB_IP_LAYOUT="$FAKE_CTDB_STATE/ip-layout" + +ip_reallocate () +{ + touch "$FAKE_CTDB_IP_LAYOUT" + + ( + flock 0 + + _pa="${CTDB_BASE}/public_addresses" + + if [ ! -s "$FAKE_CTDB_IP_LAYOUT" ] ; then + sed -n -e 's@^\([^#][^/]*\)/.*@\1 -1@p' \ + "$_pa" >"$FAKE_CTDB_IP_LAYOUT" + fi + + _t="${FAKE_CTDB_IP_LAYOUT}.new" + + _flags="" + for _i in $(seq 0 $((FAKE_CTDB_NUMNODES - 1)) ) ; do + if ls "$FAKE_CTDB_STATE/node-state/"*"/$_i" >/dev/null 2>&1 ; then + # Have non-zero flags + _this=0 + for _j in "$FAKE_CTDB_STATE/node-state/"*"/$_i" ; do + _tf="${_j%/*}" # dirname + _f="${_tf##*/}" # basename + _this=$(( $_this | $_f )) + done + else + _this="0" + fi + _flags="${_flags}${_flags:+,}${_this}" + done + CTDB_TEST_LOGLEVEL=NOTICE \ + "ctdb_takeover_tests" \ + "ipalloc" "$_flags" <"$FAKE_CTDB_IP_LAYOUT" | + sort >"$_t" + mv "$_t" "$FAKE_CTDB_IP_LAYOUT" + ) <"$FAKE_CTDB_IP_LAYOUT" +} + +ctdb_ip () +{ + # If nobody has done any IP-fu then generate a layout. + [ -f "$FAKE_CTDB_IP_LAYOUT" ] || ip_reallocate + + _mypnn=$(ctdb_pnn) + + if $machine_readable ; then + if $verbose ; then + echo "|Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|" + else + echo "|Public IP|Node|" + fi + else + echo "Public IPs on node ${_mypnn}" + fi + + # Join public addresses file with $FAKE_CTDB_IP_LAYOUT, and + # process output line by line... + _pa="${CTDB_BASE}/public_addresses" + sed -e 's@/@ @' "$_pa" | sort | join - "$FAKE_CTDB_IP_LAYOUT" | + while read _ip _bit _ifaces _pnn ; do + if $verbose ; then + # If more than 1 interface, assume all addresses are on the 1st. + _first_iface="${_ifaces%%,*}" + # Only show interface if address is on this node. + _my_iface="" + if [ "$_pnn" = "$_mypnn" ]; then + _my_iface="$_first_iface" + fi + if $machine_readable ; then + echo "|${_ip}|${_pnn}|${_my_iface}|${_first_iface}|${_ifaces}|" + else + echo "${_ip} node[${_pnn}] active[${_my_iface}] available[${_first_iface}] configured[[${_ifaces}]" + fi + else + if $machine_readable ; then + echo "|${_ip}|${_pnn}|" + else + echo "${_ip} ${_pnn}" + fi + fi + done +} + +ctdb_moveip () +{ + _ip="$1" + _target="$2" + + ip_reallocate # should be harmless and ensures we have good state + + ( + flock 0 + + _t="${FAKE_CTDB_IP_LAYOUT}.new" + + while read _i _pnn ; do + if [ "$_ip" = "$_i" ] ; then + echo "$_i $_target" + else + echo "$_i $_pnn" + fi + done | sort >"$_t" + mv "$_t" "$FAKE_CTDB_IP_LAYOUT" + ) <"$FAKE_CTDB_IP_LAYOUT" +} + +###################################################################### + +ctdb_enable () +{ + parse_nodespec + + for _i in $nodes ; do + rm -f "${FAKE_CTDB_NODES_DISABLED}/${_i}" + done + + ip_reallocate +} + +ctdb_disable () +{ + parse_nodespec + + for _i in $nodes ; do + mkdir -p "$FAKE_CTDB_NODES_DISABLED" + touch "${FAKE_CTDB_NODES_DISABLED}/${_i}" + done + + ip_reallocate +} + +###################################################################### + +ctdb_shutdown () +{ + echo "CTDB says BYE!" +} + +###################################################################### + +# This is only used by the NAT and LVS gateway code at the moment, so +# use a hack. Assume that $CTDB_NATGW_NODES or $CTDB_LVS_NODES +# contains all nodes in the cluster (which is what current tests +# assume). Use the PNN to find the address from this file. The NAT +# gateway code only used the address, so just mark the node healthy. +ctdb_nodestatus () +{ + echo '|Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|' + _line=$(( $FAKE_CTDB_PNN + 1 )) + _ip=$(sed -e "${_line}p" "${CTDB_NATGW_NODES:-${CTDB_LVS_NODES}}") + echo "|${FAKE_CTDB_PNN}|${_ip}|0|0|0|0|0|0|0|Y|" +} + +###################################################################### + +ctdb_setvar () +{ + _var="$1" + + for _i in $FAKE_CTDB_TUNABLES_OK ; do + if [ "$_var" = "$_i" ] ; then + return 0 + fi + done + + for _i in $FAKE_CTDB_TUNABLES_OBSOLETE ; do + if [ "$_var" = "$_i" ] ; then + echo "Setting obsolete tunable variable '${_var}'" + return 0 + fi + done + + echo "Unable to set tunable variable '${_var}'" + return 1 +} + +###################################################################### + +_t_setup () +{ + _t_dir="${CTDB_TEST_TMP_DIR}/fake-ctdb/fake-tdb/$1" + mkdir -p "$_t_dir" +} + +_t_put () +{ + echo "$2" >"${_t_dir}/$1" +} + +_t_get () +{ + cat "${_t_dir}/$1" +} + +_t_del () +{ + rm -f "${_t_dir}/$1" +} + +ctdb_pstore () +{ + _t_setup "$1" + _t_put "$2" "$3" +} + +ctdb_pdelete () +{ + _t_setup "$1" + _t_del "$2" +} + +ctdb_pfetch () +{ + _t_setup "$1" + _t_get "$2" >"$3" 2>/dev/null +} + +ctdb_ptrans () +{ + _t_setup "$1" + + while IFS="" read _line ; do + _k=$(echo "$_line" | sed -n -e 's@^"\([^"]*\)" "[^"]*"$@\1@p') + _v=$(echo "$_line" | sed -e 's@^"[^"]*" "\([^"]*\)"$@\1@') + [ -n "$_k" ] || die "ctdb ptrans: bad line \"${line}\"" + if [ -n "$_v" ] ; then + _t_put "$_k" "$_v" + else + _t_del "$_k" + fi + done +} + +ctdb_catdb () +{ + _t_setup "$1" + + # This will break on keys with spaces but we don't have any of + # those yet. + _count=0 + for _i in "${_t_dir}/"* ; do + [ -r "$_i" ] || continue + _k="${_i##*/}" # basename + _v=$(_t_get "$_k") + _kn=$(echo -n "$_k" | wc -c) + _vn=$(echo -n "$_v" | wc -c) + cat </dev/null 2>&1 ; then + "$func" "$@" +else + not_implemented "$cmd" +fi diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb-config b/ctdb/tests/UNIT/eventscripts/stubs/ctdb-config new file mode 100755 index 0000000..818e3db --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb-config @@ -0,0 +1,2 @@ +#!/bin/sh +exec $VALGRIND "${CTDB_SCRIPTS_HELPER_BINDIR}/ctdb-config" "$@" diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb_killtcp b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_killtcp new file mode 100755 index 0000000..cb5b6e5 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_killtcp @@ -0,0 +1,9 @@ +#!/bin/sh + +# Only supports reading from stdin + +iface="$1" # ignored + +while read src dst ; do + sed -i -e "/^${dst} ${src}\$/d" "$FAKE_NETSTAT_TCP_ESTABLISHED_FILE" +done diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs new file mode 100755 index 0000000..85e005c --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs @@ -0,0 +1,52 @@ +#!/bin/sh + +prog="ctdb_lvs" + +# Print a message and exit. +die () +{ + echo "$1" >&2 ; exit ${2:-1} +} + +not_implemented_exit_code=1 + +usage () +{ + cat >&2 <&2 + exit $not_implemented_exit_code +} + +ctdb_lvs_leader () +{ + if [ -n "$FAKE_CTDB_LVS_LEADER" ] ; then + echo "$FAKE_CTDB_LVS_LEADER" + return 0 + else + return 255 + fi +} + +ctdb_lvs_list () +{ + _pnn=0 + while read _ip _opts ; do + echo "${_pnn} ${_ip}" + _pnn=$(($_pnn + 1)) + done <"$CTDB_LVS_NODES" +} + +###################################################################### + +case "$1" in + leader) ctdb_lvs_leader "$@" ;; + list) ctdb_lvs_list "$@" ;; + *) not_implemented "$1" ;; +esac diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw new file mode 100755 index 0000000..e64a956 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw @@ -0,0 +1,34 @@ +#!/bin/sh + +prog="ctdb_natgw" + +not_implemented_exit_code=1 + +not_implemented () +{ + echo "${prog}: command \"$1\" not implemented in stub" >&2 + exit $not_implemented_exit_code +} + +ctdb_natgw_leader () +{ + [ -r "$CTDB_NATGW_NODES" ] || \ + die "error: missing CTDB_NATGW_NODES=${CTDB_NATGW_NODES}" + + # Determine the leader node + _leader="-1 0.0.0.0" + _pnn=0 + while read _ip ; do + if [ "$FAKE_CTDB_NATGW_LEADER" = "$_ip" ] ; then + _leader="${_pnn} ${_ip}" + break + fi + _pnn=$(($_pnn + 1)) + done <"$CTDB_NATGW_NODES" + echo "$_leader" +} + +case "$1" in + leader) ctdb_natgw_leader "$@" ;; + *) not_implemented "$1" ;; +esac diff --git a/ctdb/tests/UNIT/eventscripts/stubs/date b/ctdb/tests/UNIT/eventscripts/stubs/date new file mode 100755 index 0000000..2f470a8 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/date @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "$FAKE_DATE_OUTPUT" ] ; then + echo "$FAKE_DATE_OUTPUT" +else + /bin/date "$@" +fi diff --git a/ctdb/tests/UNIT/eventscripts/stubs/df b/ctdb/tests/UNIT/eventscripts/stubs/df new file mode 100755 index 0000000..a2e7093 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/df @@ -0,0 +1,38 @@ +#!/bin/sh + +usage () +{ + echo "usage: df [-kP] []" + exit 1 +} + +if [ "$1" = "-kP" ] ; then + shift +fi + +case "$1" in + -*) usage ;; +esac + +fs="${1:-/}" + +# Anything starting with CTDB_DBDIR_BASE gets canonicalised to +# CTDB_DBDIR_BASE. This helps with the setting of defaults for the +# filesystem checks. +if [ "${fs#${CTDB_DBDIR_BASE}}" != "$fs" ] ; then + fs="$CTDB_DBDIR_BASE" +fi + +# A default, for tests that don't initialise this... +if [ -z "$FAKE_FS_USE" ] ; then + FAKE_FS_USE=10 +fi + +echo "Filesystem 1024-blocks Used Available Capacity Mounted on" + +blocks="1000000" +used=$(($blocks * $FAKE_FS_USE / 100)) +available=$(($blocks - $used)) + +printf "%-36s %10d %10d %10d %10d%% %s\n" \ + "/dev/sda1" "$blocks" "$used" "$available" "$FAKE_FS_USE" "$fs" diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ethtool b/ctdb/tests/UNIT/eventscripts/stubs/ethtool new file mode 100755 index 0000000..bd173f4 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ethtool @@ -0,0 +1,12 @@ +#!/bin/sh + +link="yes" + +if [ -f "${FAKE_ETHTOOL_LINK_DOWN}/${1}" ] ; then + link="no" +fi + +# Expect to add more fields later. +cat <, argv=) at ${command}.c +EOF diff --git a/ctdb/tests/UNIT/eventscripts/stubs/id b/ctdb/tests/UNIT/eventscripts/stubs/id new file mode 100755 index 0000000..1ecd2f8 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/id @@ -0,0 +1,3 @@ +#!/bin/sh +# Make statd-callout happy +echo 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ip b/ctdb/tests/UNIT/eventscripts/stubs/ip new file mode 100755 index 0000000..630d0e8 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ip @@ -0,0 +1,679 @@ +#!/bin/sh + +FAKE_IP_STATE="${FAKE_NETWORK_STATE}/ip-state" +mkdir -p "$FAKE_IP_STATE" + +promote_secondaries=true + +not_implemented () +{ + echo "ip stub command: \"$1\" not implemented" + exit 127 +} + +###################################################################### + +ip_link () +{ + case "$1" in + set) + shift + # iface="$1" + case "$2" in + up) ip_link_set_up "$1" ;; + down) ip_link_down_up "$1" ;; + *) not_implemented "\"$2\" in \"$orig_args\"" ;; + esac + ;; + show) shift ; ip_link_show "$@" ;; + add*) shift ; ip_link_add "$@" ;; + del*) shift ; ip_link_delete "$@" ;; + *) not_implemented "$*" ;; + esac +} + +ip_link_add () +{ + _link="" + _name="" + _type="" + + while [ -n "$1" ] ; do + case "$1" in + link) + _link="$2" + shift 2 + ;; + name) + _name="$2" + shift 2 + ;; + type) + if [ "$2" != "vlan" ] ; then + not_implemented "link type $1" + fi + _type="$2" + shift 2 + ;; + id) shift 2 ;; + *) not_implemented "$1" ;; + esac + done + + case "$_type" in + vlan) + if [ -z "$_name" -o -z "$_link" ] ; then + not_implemented "ip link add with null name or link" + fi + + mkdir -p "${FAKE_IP_STATE}/interfaces-vlan" + echo "$_link" >"${FAKE_IP_STATE}/interfaces-vlan/${_name}" + ip_link_set_down "$_name" + ;; + esac +} + +ip_link_delete () +{ + mkdir -p "${FAKE_IP_STATE}/interfaces-deleted" + touch "${FAKE_IP_STATE}/interfaces-deleted/$1" + rm -f "${FAKE_IP_STATE}/interfaces-vlan/$1" +} + +ip_link_set_up () +{ + rm -f "${FAKE_IP_STATE}/interfaces-down/$1" + rm -f "${FAKE_IP_STATE}/interfaces-deleted/$1" +} + +ip_link_set_down () +{ + rm -f "${FAKE_IP_STATE}/interfaces-deleted/$1" + mkdir -p "${FAKE_IP_STATE}/interfaces-down" + touch "${FAKE_IP_STATE}/interfaces-down/$1" +} + +ip_link_show () +{ + dev="$1" + if [ "$dev" = "dev" -a -n "$2" ] ; then + dev="$2" + fi + + if [ -e "${FAKE_IP_STATE}/interfaces-deleted/$dev" ] ; then + echo "Device \"${dev}\" does not exist." >&2 + exit 255 + fi + + if [ -r "${FAKE_IP_STATE}/interfaces-vlan/${dev}" ] ; then + read _link <"${FAKE_IP_STATE}/interfaces-vlan/${dev}" + dev="${dev}@${_link}" + fi + + _state="UP" + _flags=",UP,LOWER_UP" + if [ -e "${FAKE_IP_STATE}/interfaces-down/$dev" ] ; then + _state="DOWN" + _flags="" + fi + case "$dev" in + lo) + _mac="00:00:00:00:00:00" + _brd="00:00:00:00:00:00" + _type="loopback" + _opts=" mtu 65536 qdisc noqueue state UNKNOWN" + ;; + *) + _mac=$(echo $dev | cksum | sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@') + _brd="ff:ff:ff:ff:ff:ff" + _type="ether" + _opts=" mtu 1500 qdisc pfifo_fast state ${_state} qlen 1000" + esac + echo "${n:-42}: ${dev}: ${_opts}" + echo " link/${_type} ${_mac} brd ${_brd}" +} + +# This is incomplete because it doesn't actually look up table ids in +# /etc/iproute2/rt_tables. The rules/routes are actually associated +# with the name instead of the number. However, we include a variable +# to fake a bad table id. +[ -n "$IP_ROUTE_BAD_TABLE_ID" ] || IP_ROUTE_BAD_TABLE_ID=false + +ip_check_table () +{ + _cmd="$1" + + if [ "$_cmd" = "route" -a -z "$_table" ] ;then + _table="main" + fi + + [ -n "$_table" ] || not_implemented "ip rule/route without \"table\"" + + # Only allow tables names from 13.per_ip_routing and "main". This + # is a cheap way of avoiding implementing the default/local + # tables. + case "$_table" in + ctdb.*|main) + if $IP_ROUTE_BAD_TABLE_ID ; then + # Ouch. Simulate inconsistent errors from ip. :-( + case "$_cmd" in + route) + echo "Error: argument "${_table}" is wrong: table id value is invalid" >&2 + + ;; + *) + echo "Error: argument "${_table}" is wrong: invalid table ID" >&2 + esac + exit 255 + fi + ;; + *) not_implemented "table=${_table} ${orig_args}" ;; + esac +} + +###################################################################### + +ip_addr () +{ + case "$1" in + show|list|"") shift ; ip_addr_show "$@" ;; + add*) shift ; ip_addr_add "$@" ;; + del*) shift ; ip_addr_del "$@" ;; + *) not_implemented "\"$1\" in \"$orig_args\"" ;; + esac +} + +ip_addr_show () +{ + dev="" + primary=true + secondary=true + _to="" + while [ -n "$1" ] ; do + case "$1" in + dev) + dev="$2" ; shift 2 + ;; + # Do stupid things and stupid things will happen! + primary) + primary=true ; secondary=false ; shift + ;; + secondary) + secondary=true ; primary=false ; shift + ;; + to) + _to="$2" ; shift 2 + ;; + *) + # Assume an interface name + dev="$1" ; shift 1 + esac + done + devices="$dev" + if [ -z "$devices" ] ; then + # No device specified? Get all the primaries... + devices=$(ls "${FAKE_IP_STATE}/addresses/"*-primary 2>/dev/null | \ + sed -e 's@.*/@@' -e 's@-.*-primary$@@' | sort -u) + fi + calc_brd () + { + case "${local#*/}" in + 24) brd="${local%.*}.255" ;; + 32) brd="" ;; + *) not_implemented "list ... fake bits other than 24/32: ${local#*/}" + esac + } + show_iface() + { + ip_link_show "$dev" + + nets=$(ls "${FAKE_IP_STATE}/addresses/${dev}"-*-primary 2>/dev/null | \ + sed -e 's@.*/@@' -e "s@${dev}-\(.*\)-primary\$@\1@") + + for net in $nets ; do + pf="${FAKE_IP_STATE}/addresses/${dev}-${net}-primary" + sf="${FAKE_IP_STATE}/addresses/${dev}-${net}-secondary" + if $primary && [ -r "$pf" ] ; then + read local scope <"$pf" + if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then + calc_brd + echo " inet ${local} ${brd:+brd ${brd} }scope ${scope} ${dev}" + fi + fi + if $secondary && [ -r "$sf" ] ; then + while read local scope ; do + if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then + calc_brd + echo " inet ${local} ${brd:+brd }${brd} scope ${scope} secondary ${dev}" + fi + done <"$sf" + fi + if [ -z "$_to" ] ; then + echo " valid_lft forever preferred_lft forever" + fi + done + } + n=1 + for dev in $devices ; do + if [ -z "$_to" ] || \ + grep -F "${_to%/*}/" "${FAKE_IP_STATE}/addresses/${dev}-"* >/dev/null ; then + show_iface + fi + n=$(($n + 1)) + done +} + +# Copied from 13.per_ip_routing for now... so this is lazy testing :-( +ipv4_host_addr_to_net () +{ + _host="$1" + _maskbits="$2" + + # Convert the host address to an unsigned long by splitting out + # the octets and doing the math. + _host_ul=0 + for _o in $(export IFS="." ; echo $_host) ; do + _host_ul=$(( ($_host_ul << 8) + $_o)) # work around Emacs color bug + done + + # Calculate the mask and apply it. + _mask_ul=$(( 0xffffffff << (32 - $_maskbits) )) + _net_ul=$(( $_host_ul & $_mask_ul )) + + # Now convert to a network address one byte at a time. + _net="" + for _o in $(seq 1 4) ; do + _net="$(($_net_ul & 255))${_net:+.}${_net}" + _net_ul=$(($_net_ul >> 8)) + done + + echo "${_net}/${_maskbits}" +} + +ip_addr_add () +{ + local="" + dev="" + brd="" + scope="global" + while [ -n "$1" ] ; do + case "$1" in + *.*.*.*/*) + local="$1" ; shift + ;; + local) + local="$2" ; shift 2 + ;; + broadcast|brd) + # For now assume this is always '+'. + if [ "$2" != "+" ] ; then + not_implemented "addr add ... brd $2 ..." + fi + shift 2 + ;; + dev) + dev="$2" ; shift 2 + ;; + scope) + scope="$2" ; shift 2 + ;; + *) + not_implemented "$@" + esac + done + if [ -z "$dev" ] ; then + not_implemented "addr add (without dev)" + fi + mkdir -p "${FAKE_IP_STATE}/addresses" + net_str=$(ipv4_host_addr_to_net $(IFS="/" ; echo $local)) + net_str=$(echo "$net_str" | sed -e 's@/@_@') + pf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-primary" + sf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-secondary" + # We could lock here... but we should be the only ones playing + # around here with these stubs. + if [ ! -f "$pf" ] ; then + echo "$local $scope" >"$pf" + elif grep -Fq "$local" "$pf" ; then + echo "RTNETLINK answers: File exists" >&2 + exit 254 + elif [ -f "$sf" ] && grep -Fq "$local" "$sf" ; then + echo "RTNETLINK answers: File exists" >&2 + exit 254 + else + echo "$local $scope" >>"$sf" + fi +} + +ip_addr_del () +{ + local="" + dev="" + while [ -n "$1" ] ; do + case "$1" in + *.*.*.*/*) + local="$1" ; shift + ;; + local) + local="$2" ; shift 2 + ;; + dev) + dev="$2" ; shift 2 + ;; + *) + not_implemented "addr del ... $1 ..." + esac + done + if [ -z "$dev" ] ; then + not_implemented "addr del (without dev)" + fi + mkdir -p "${FAKE_IP_STATE}/addresses" + net_str=$(ipv4_host_addr_to_net $(IFS="/" ; echo $local)) + net_str=$(echo "$net_str" | sed -e 's@/@_@') + pf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-primary" + sf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-secondary" + # We could lock here... but we should be the only ones playing + # around here with these stubs. + if [ ! -f "$pf" ] ; then + echo "RTNETLINK answers: Cannot assign requested address" >&2 + exit 254 + elif grep -Fq "$local" "$pf" ; then + if $promote_secondaries && [ -s "$sf" ] ; then + head -n 1 "$sf" >"$pf" + sed -i -e '1d' "$sf" + else + # Remove primaries AND SECONDARIES. + rm -f "$pf" "$sf" + fi + elif [ -f "$sf" ] && grep -Fq "$local" "$sf" ; then + grep -Fv "$local" "$sf" >"${sf}.new" + mv "${sf}.new" "$sf" + else + echo "RTNETLINK answers: Cannot assign requested address" >&2 + exit 254 + fi +} + +###################################################################### + +ip_rule () +{ + case "$1" in + show|list|"") shift ; ip_rule_show "$@" ;; + add) shift ; ip_rule_add "$@" ;; + del*) shift ; ip_rule_del "$@" ;; + *) not_implemented "$1 in \"$orig_args\"" ;; + esac + +} + +# All non-default rules are in $FAKE_IP_STATE_RULES/rules. As with +# the real version, rules can be repeated. Deleting just deletes the +# 1st match. + +ip_rule_show () +{ + ip_rule_show_1 () + { + _pre="$1" + _table="$2" + _selectors="$3" + # potentially more options + + printf "%d:\t%s lookup %s \n" $_pre "$_selectors" "$_table" + } + + ip_rule_show_some () + { + _min="$1" + _max="$2" + + [ -f "${FAKE_IP_STATE}/rules" ] || return + + while read _pre _table _selectors ; do + # Only print those in range + [ $_min -le $_pre -a $_pre -le $_max ] || continue + + ip_rule_show_1 $_pre "$_table" "$_selectors" + done <"${FAKE_IP_STATE}/rules" + } + + ip_rule_show_1 0 "local" "from all" + + ip_rule_show_some 1 32765 + + ip_rule_show_1 32766 "main" "from all" + ip_rule_show_1 32767 "default" "from all" + + ip_rule_show_some 32768 2147483648 +} + +ip_rule_common () +{ + _from="" + _pre="" + _table="" + while [ -n "$1" ] ; do + case "$1" in + from) _from="$2" ; shift 2 ;; + pref) _pre="$2" ; shift 2 ;; + table) _table="$2" ; shift 2 ;; + *) not_implemented "$1 in \"$orig_args\"" ;; + esac + done + + [ -n "$_pre" ] || not_implemented "ip rule without \"pref\"" + ip_check_table "rule" + # Relax this if more selectors added later... + [ -n "$_from" ] || not_implemented "ip rule without \"from\"" +} + +ip_rule_add () +{ + ip_rule_common "$@" + + _f="${FAKE_IP_STATE}/rules" + touch "$_f" + ( + flock 0 + # Filter order must be consistent with the comparison in ip_rule_del() + echo "$_pre $_table${_from:+ from }$_from" >>"$_f" + ) <"$_f" +} + +ip_rule_del () +{ + ip_rule_common "$@" + + _f="${FAKE_IP_STATE}/rules" + touch "$_f" + ( + flock 0 + _tmp="${_f}.new" + : >"$_tmp" + _found=false + while read _p _t _s ; do + if ! $_found && \ + [ "$_p" = "$_pre" -a "$_t" = "$_table" -a \ + "$_s" = "${_from:+from }$_from" ] ; then + # Found. Skip this one but not future ones. + _found=true + else + echo "$_p $_t $_s" >>"$_tmp" + fi + done + if cmp -s "$_tmp" "$_f" ; then + # No changes, must not have found what we wanted to delete + echo "RTNETLINK answers: No such file or directory" >&2 + rm -f "$_tmp" + exit 2 + else + mv "$_tmp" "$_f" + fi + ) <"$_f" || exit $? +} + +###################################################################### + +ip_route () +{ + case "$1" in + show|list) shift ; ip_route_show "$@" ;; + flush) shift ; ip_route_flush "$@" ;; + add) shift ; ip_route_add "$@" ;; + del*) shift ; ip_route_del "$@" ;; + *) not_implemented "$1 in \"ip route\"" ;; + esac +} + +ip_route_common () +{ + if [ "$1" = table ] ; then + _table="$2" + shift 2 + fi + + ip_check_table "route" +} + +# Routes are in a file per table in the directory +# $FAKE_IP_STATE/routes. These routes just use the table ID +# that is passed and don't do any lookup. This could be "improved" if +# necessary. + +ip_route_show () +{ + ip_route_common "$@" + + # Missing file is just an empty table + sort "$FAKE_IP_STATE/routes/${_table}" 2>/dev/null || true +} + +ip_route_flush () +{ + ip_route_common "$@" + + rm -f "$FAKE_IP_STATE/routes/${_table}" +} + +ip_route_add () +{ + _prefix="" + _dev="" + _gw="" + _table="" + _metric="" + + while [ -n "$1" ] ; do + case "$1" in + *.*.*.*/*|*.*.*.*) _prefix="$1" ; shift 1 ;; + local) _prefix="$2" ; shift 2 ;; + dev) _dev="$2" ; shift 2 ;; + via) _gw="$2" ; shift 2 ;; + table) _table="$2" ; shift 2 ;; + metric) _metric="$2" ; shift 2 ;; + *) not_implemented "$1 in \"$orig_args\"" ;; + esac + done + + ip_check_table "route" + [ -n "$_prefix" ] || not_implemented "ip route without inet prefix in \"$orig_args\"" + # This can't be easily deduced, so print some garbage. + [ -n "$_dev" ] || _dev="ethXXX" + + # Alias or add missing bits + case "$_prefix" in + 0.0.0.0/0) _prefix="default" ;; + */*) : ;; + *) _prefix="${_prefix}/32" ;; + esac + + _f="$FAKE_IP_STATE/routes/${_table}" + mkdir -p "$FAKE_IP_STATE/routes" + touch "$_f" + + # Check for duplicate + _prefix_regexp=$(echo "^${_prefix}" | sed -e 's@\.@\\.@g') + if [ -n "$_metric" ] ; then + _prefix_regexp="${_prefix_regexp} .*metric ${_metric} " + fi + if grep -q "$_prefix_regexp" "$_f" ; then + echo "RTNETLINK answers: File exists" >&2 + exit 1 + fi + + ( + flock 0 + + _out="${_prefix} " + [ -z "$_gw" ] || _out="${_out}via ${_gw} " + [ -z "$_dev" ] || _out="${_out}dev ${_dev} " + [ -n "$_gw" ] || _out="${_out} scope link " + [ -z "$_metric" ] || _out="${_out} metric ${_metric} " + echo "$_out" >>"$_f" + ) <"$_f" +} + +ip_route_del () +{ + _prefix="" + _dev="" + _gw="" + _table="" + _metric="" + + while [ -n "$1" ] ; do + case "$1" in + *.*.*.*/*|*.*.*.*) _prefix="$1" ; shift 1 ;; + local) _prefix="$2" ; shift 2 ;; + dev) _dev="$2" ; shift 2 ;; + via) _gw="$2" ; shift 2 ;; + table) _table="$2" ; shift 2 ;; + metric) _metric="$2" ; shift 2 ;; + *) not_implemented "$1 in \"$orig_args\"" ;; + esac + done + + ip_check_table "route" + [ -n "$_prefix" ] || not_implemented "ip route without inet prefix in \"$orig_args\"" + # This can't be easily deduced, so print some garbage. + [ -n "$_dev" ] || _dev="ethXXX" + + # Alias or add missing bits + case "$_prefix" in + 0.0.0.0/0) _prefix="default" ;; + */*) : ;; + *) _prefix="${_prefix}/32" ;; + esac + + _f="$FAKE_IP_STATE/routes/${_table}" + mkdir -p "$FAKE_IP_STATE/routes" + touch "$_f" + + ( + flock 0 + + # Escape some dots + [ -z "$_gw" ] || _gw=$(echo "$_gw" | sed -e 's@\.@\\.@g') + _prefix=$(echo "$_prefix" | sed -e 's@\.@\\.@g' -e 's@/@\\/@') + + _re="^${_prefix}\>.*" + [ -z "$_gw" ] || _re="${_re}\.*" + [ -z "$_dev" ] || _re="${_re}\.*" + [ -z "$_metric" ] || _re="${_re}.*\.*" + sed -i -e "/${_re}/d" "$_f" + ) <"$_f" +} + +###################################################################### + +orig_args="$*" + +case "$1" in + link) shift ; ip_link "$@" ;; + addr*) shift ; ip_addr "$@" ;; + rule) shift ; ip_rule "$@" ;; + route) shift ; ip_route "$@" ;; + *) not_implemented "$1" ;; +esac + +exit 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ip6tables b/ctdb/tests/UNIT/eventscripts/stubs/ip6tables new file mode 100755 index 0000000..2c65f7b --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ip6tables @@ -0,0 +1,5 @@ +#!/bin/sh + +# Always succeed. + +exit 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/iptables b/ctdb/tests/UNIT/eventscripts/stubs/iptables new file mode 100755 index 0000000..2c65f7b --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/iptables @@ -0,0 +1,5 @@ +#!/bin/sh + +# Always succeed. + +exit 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ipvsadm b/ctdb/tests/UNIT/eventscripts/stubs/ipvsadm new file mode 100755 index 0000000..0567f88 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ipvsadm @@ -0,0 +1,126 @@ +#!/bin/sh + +die () +{ + echo "$1" >&2 + exit ${2:-1} +} + + +[ -n "$FAKE_LVS_STATE_DIR" ] || die "FAKE_LVS_STATE_DIR not set" + + +service_address="" +scheduling_method="wlc" +persistent_timeout="" +real_server="" +forwarding_method="Route" + +set_service_address () +{ + [ -z "$service_address" ] || + die "multiple 'service-address' options specified" 2 + case "$2" in + *:*) service_address="${1} ${2}" ;; + *) service_address="${1} ${2}:0" ;; + esac +} + +set_real_server () +{ + [ -z "$real_server" ] || + die "multiple 'real-server' options specified" 2 + case "$1" in + *\]:*) real_server="${1}" ;; + *\]) real_server="${1}:0" ;; + *:*) real_server="${1}" ;; + *) real_server="${1}:0" ;; + esac + + case "$real_server" in + 127.0.0.1:*|\[::1\]:*) forwarding_method="Local" ;; + esac +} + +case "$1" in +-A) + shift + while [ -n "$1" ] ; do + case "$1" in + -t) set_service_address "TCP" "$2" ; shift 2 ;; + -u) set_service_address "UDP" "$2" ; shift 2 ;; + -s) scheduling_method="$2" ; shift 2 ;; + -p) persistent_timeout="persistent $2" ; shift 2 ;; + *) die "Unsupported -A option $1" ;; + esac + done + [ -n "$service_address" ] || + die "You need to supply the 'service-address' option for the 'add-service' command" 2 + d="${FAKE_LVS_STATE_DIR}/${service_address}" + mkdir "$d" 2>/dev/null || die "Service already exists" 255 + t="${scheduling_method}${persistent_timeout:+ }${persistent_timeout}" + echo "$t" >"${d}/.info" + ;; +-D) + shift + while [ -n "$1" ] ; do + case "$1" in + -t) set_service_address "TCP" "$2" ; shift 2 ;; + -u) set_service_address "UDP" "$2" ; shift 2 ;; + *) die "Unsupported -D option $1" ;; + esac + done + [ -n "$service_address" ] || + die "You need to supply the 'service-address' option for the 'delete-service' command" 2 + d="${FAKE_LVS_STATE_DIR}/${service_address}" + rm -f "${d}/"* + rm -f "${d}/.info" + rmdir "$d" 2>/dev/null || die "No such service" 255 + ;; +-a) + shift + while [ -n "$1" ] ; do + case "$1" in + -t) set_service_address "TCP" "$2" ; shift 2 ;; + -u) set_service_address "UDP" "$2" ; shift 2 ;; + -r) set_real_server "$2" ; shift 2 ;; + -g) forwarding_method="Route" ; shift 1 ;; + *) die "Unsupported -A option $1" ;; + esac + done + [ -n "$service_address" ] || + die "You need to supply the 'service-address' option for the 'delete-service' command" 2 + d="${FAKE_LVS_STATE_DIR}/${service_address}" + [ -d "$d" ] || die "Service not defined" 255 + [ -n "$real_server" ] || + die "You need to supply the 'real-server' option for the 'add-server' command" 2 + f="${d}/${real_server}" + echo "$forwarding_method" >"$f" + ;; +-l) + cat < RemoteAddress:Port Forward Weight ActiveConn InActConn +EOF + [ -d "$FAKE_LVS_STATE_DIR" ] || exit 0 + ( + cd "$FAKE_LVS_STATE_DIR" + for d in *; do + [ -d "$d" ] || continue + echo -n "$d " + cat "${d}/.info" + for f in "${d}/"* ; do + [ -f "$f" ] || continue + read forwarding_method <"$f" + printf " -> %-28s %-7s %-6s %-10s %-10s\n" \ + "${f##*/}" "$forwarding_method" 1 0 0 + done + done + ) + ;; +*) + die "Unknown option $1" +esac + +exit 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/kill b/ctdb/tests/UNIT/eventscripts/stubs/kill new file mode 100755 index 0000000..b69e3e6 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/kill @@ -0,0 +1,7 @@ +#!/bin/sh + +# Always succeed. This means that kill -0 will always find a +# process and anything else will successfully kill. This should +# exercise a good avriety of code paths. + +exit 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/killall b/ctdb/tests/UNIT/eventscripts/stubs/killall new file mode 100755 index 0000000..1e182e1 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/killall @@ -0,0 +1,7 @@ +#!/bin/sh + +# Always succeed. This means that killall -0 will always find a +# process and anything else will successfully kill. This should +# exercise a good avriety of code paths. + +exit 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/multipath b/ctdb/tests/UNIT/eventscripts/stubs/multipath new file mode 100755 index 0000000..64f95e7 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/multipath @@ -0,0 +1,36 @@ +#!/bin/sh + +usage () +{ + die "usage: ${0} -ll device" +} + +[ "$1" = "-ll" ] || usage +shift +[ $# -eq 1 ] || usage + +device="$1" + +if [ -n "$FAKE_MULTIPATH_HANG" ] ; then + FAKE_SLEEP_REALLY="yes" sleep 999 +fi + +path1_state="active" +path2_state="enabled" + +for i in $FAKE_MULTIPATH_FAILURES ; do + if [ "$device" = "$i" ] ; then + path1_state="inactive" + path2_state="inactive" + break + fi +done + + cat <&2 <&2 + echo "program ${p} version ${v} is not available" + exit 1 + fi + else + for j in $(seq $2 $3) ; do + echo "program ${p} version ${j} ready and waiting" + done + exit 0 + fi + fi +done + +echo "rpcinfo: RPC: Program not registered" >&2 +if [ -n "$v" ] ; then + echo "program ${p} version ${v} is not available" +else + echo "program ${p} is not available" +fi + +exit 1 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/service b/ctdb/tests/UNIT/eventscripts/stubs/service new file mode 100755 index 0000000..3d6ddf4 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/service @@ -0,0 +1,64 @@ +#!/bin/sh + +service_status_dir="${CTDB_TEST_TMP_DIR}/service_fake_status" +mkdir -p "$service_status_dir" + +service="$1" +flag="${service_status_dir}/${service}" + +start() +{ + if [ -f "$flag" ] ; then + echo "service: can't start ${service} - already running" + exit 1 + else + touch "$flag" + echo "Starting ${service}: OK" + fi +} + +stop () +{ + if [ -f "$flag" ] ; then + echo "Stopping ${service}: OK" + rm -f "$flag" + else + echo "service: can't stop ${service} - not running" + exit 1 + fi +} + +case "$2" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + ;; + status) + if [ -f "$flag" ] ; then + echo "$service running" + exit 0 + else + echo "$service not running" + exit 3 + fi + ;; + force-started) + # For test setup... + touch "$flag" + ;; + force-stopped) + # For test setup... + rm -f "$flag" + ;; + *) + echo "service $service $2 not supported" + exit 1 +esac + +exit 0 diff --git a/ctdb/tests/UNIT/eventscripts/stubs/sleep b/ctdb/tests/UNIT/eventscripts/stubs/sleep new file mode 100755 index 0000000..e454244 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/sleep @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$FAKE_SLEEP_REALLY" = "yes" ] ; then + /bin/sleep "$@" +elif [ -n "$FAKE_SLEEP_FORCE" ] ; then + /bin/sleep "$FAKE_SLEEP_FORCE" +else + : +fi diff --git a/ctdb/tests/UNIT/eventscripts/stubs/smnotify b/ctdb/tests/UNIT/eventscripts/stubs/smnotify new file mode 100755 index 0000000..7871034 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/smnotify @@ -0,0 +1,38 @@ +#!/bin/sh + +usage() +{ + _prog="${0##*/}" # basename + cat < ${cip}, MON_NAME=${mon_name}, STATE=${state}" diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ss b/ctdb/tests/UNIT/eventscripts/stubs/ss new file mode 100755 index 0000000..54ff436 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/ss @@ -0,0 +1,193 @@ +#!/bin/sh + +prog="ss" + +usage () +{ + cat >&2 <&2 + usage +} + +############################################################ + +# +parse_filter () +{ + # Very limited implementation: + # We only expect to find || inside parentheses + # We don't expect to see && - it is implied by juxtaposition + # Operator for port comparison is ignored and assumed to be == + + # Build lists of source ports and source IP addresses where + # each entry is surrounded by '|' characters. These lists can + # be easily "searched" using the POSIX prefix and suffix + # removal operators. + in_parens=false + sports="|" + srcs="|" + + while [ -n "$1" ] ; do + case "$1" in + \() + in_parens=true + shift + ;; + \)) + in_parens=false + shift + ;; + \|\|) + if ! $in_parens ; then + not_supported "|| in parentheses" + fi + shift + ;; + sport) + p="${3#:}" ; sports="${sports}${p}|" + shift 3 + ;; + src) + ip="${2#\[}" ; ip="${ip%\]}" ; srcs="${srcs}${ip}|" + shift 2 + ;; + *) + usage + ;; + esac + done +} + +# Check if socket has matches in both ok_ips and ok_ports +filter_socket () +{ + ok_ips="$1" + ok_ports="$2" + socket="$3" + + ip="${socket%:*}" + port="${socket##*:}" + + if [ "$ok_ports" != "|" -a "${ok_ports#*|${port}|}" = "$ok_ports" ] ; then + return 1 + fi + if [ "$ok_ips" != "|" -a "${ok_ips#*|${ip}|}" = "$ok_ips" ] ; then + return 1 + fi + + return 0 +} + +ss_tcp_established () +{ + if $header ; then + echo "Recv-Q Send-Q Local Address:Port Peer Address:Port" + fi + + parse_filter $* + + for i in $FAKE_NETSTAT_TCP_ESTABLISHED ; do + src="${i%|*}" + dst="${i#*|}" + if filter_socket "$srcs" "$sports" "$src" ; then + echo 0 0 "$src" "$dst" + fi + done + + if [ -z "$FAKE_NETSTAT_TCP_ESTABLISHED_FILE" ] ; then + return + fi + while read src dst ; do + if filter_socket "$srcs" "$sports" "$src" ; then + echo 0 0 "$src" "$dst" + fi + done <"$FAKE_NETSTAT_TCP_ESTABLISHED_FILE" +} + +############################################################ + +unix_listen () +{ + if $header ; then + cat <&2 + exit 2 +} + +error () +{ + cat >&2 <&2 + + cat >&2 <&2 +} + +if [ -n "$FAKE_TESTPARM_FAIL" ] ; then + error +fi + +if [ -n "$FAKE_TIMEOUT" ] ; then + timeout +fi + +# Ensure that testparm always uses our canned configuration instead of +# the global one, unless some other file is specified. + +file="" +parameter="" +for i ; do + case "$i" in + --parameter-name=*) parameter="${i#--parameter-name=}" ;; + -*) : ;; + *) file="$i" ;; + esac +done + +# Just hard-code parameter requests for now. Later on they could be +# parsed out of the file. +case "$parameter" in + security) echo "ADS" ; exit 0 ;; + smb*ports) echo "445, 139" ; exit 0 ;; + ?*) not_implemented "--parameter-name=$parameter" ;; + # Fall through if $parameter not set +esac + +if [ -n "$file" ] ; then + # This should include the shares, since this is used when the + # samba eventscript caches the output. + cat "$file" +else + # We force our own smb.conf and add the shares. + cat "${CTDB_SYS_ETCDIR}/samba/smb.conf" + + for i in $FAKE_SHARES ; do + bi=$(basename "$i") +cat <> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.102 << +-n 192.168.1.102 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/ctdb/tests/UNIT/onnode/0002.sh b/ctdb/tests/UNIT/onnode/0002.sh new file mode 100755 index 0000000..c3c8c77 --- /dev/null +++ b/ctdb/tests/UNIT/onnode/0002.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +cmd="$ONNODE -q all hostname" + +define_test "$cmd" "all nodes OK" + +required_result <> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/ctdb/tests/UNIT/onnode/0010.sh b/ctdb/tests/UNIT/onnode/0010.sh new file mode 100755 index 0000000..241cf58 --- /dev/null +++ b/ctdb/tests/UNIT/onnode/0010.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +cmd="$ONNODE 4 hostname" + +define_test "$cmd" "invalid pnn 4" + +required_result 1 <> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.102 << +-n 192.168.1.102 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/ctdb/tests/UNIT/onnode/0071.sh b/ctdb/tests/UNIT/onnode/0071.sh new file mode 100755 index 0000000..4f945ac --- /dev/null +++ b/ctdb/tests/UNIT/onnode/0071.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +cmd="$ONNODE ok hostname" + +define_test "$cmd" "2nd node disconnected" + +ctdb_set_output <> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/ctdb/tests/UNIT/onnode/0072.sh b/ctdb/tests/UNIT/onnode/0072.sh new file mode 100755 index 0000000..51a4c46 --- /dev/null +++ b/ctdb/tests/UNIT/onnode/0072.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +cmd="$ONNODE ok hostname" + +define_test "$cmd" "2nd node disconnected, extra status columns" + +ctdb_set_output <> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/ctdb/tests/UNIT/onnode/0075.sh b/ctdb/tests/UNIT/onnode/0075.sh new file mode 100755 index 0000000..92fe220 --- /dev/null +++ b/ctdb/tests/UNIT/onnode/0075.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +cmd="$ONNODE con hostname" + +define_test "$cmd" "1st node disconnected" + +ctdb_set_output <> NODE: 192.168.1.102 << +-n 192.168.1.102 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/ctdb/tests/UNIT/onnode/etc-ctdb/nodes b/ctdb/tests/UNIT/onnode/etc-ctdb/nodes new file mode 100644 index 0000000..e2fe268 --- /dev/null +++ b/ctdb/tests/UNIT/onnode/etc-ctdb/nodes @@ -0,0 +1,4 @@ +192.168.1.101 +192.168.1.102 +192.168.1.103 +192.168.1.104 diff --git a/ctdb/tests/UNIT/onnode/scripts/local.sh b/ctdb/tests/UNIT/onnode/scripts/local.sh new file mode 100644 index 0000000..5b830c8 --- /dev/null +++ b/ctdb/tests/UNIT/onnode/scripts/local.sh @@ -0,0 +1,64 @@ +# Hey Emacs, this is a -*- shell-script -*- !!! :-) + +# Default to just "onnode". +: ${ONNODE:=onnode} + +# Augment PATH with relevant stubs/ directory +stubs_dir="${CTDB_TEST_SUITE_DIR}/stubs" +[ -d "${stubs_dir}" ] || die "Failed to locate stubs/ subdirectory" +PATH="${stubs_dir}:${PATH}" + +setup_ctdb_base "$CTDB_TEST_TMP_DIR" "etc-ctdb" \ + functions + +define_test () +{ + _f=$(basename "$0") + + echo "$_f $1 - $2" +} + +# Set output for ctdb command. Option 1st argument is return code. +ctdb_set_output () +{ + _out="${CTDB_TEST_TMP_DIR}/ctdb.out" + cat >"$_out" + + _rc="${CTDB_TEST_TMP_DIR}/ctdb.rc" + echo "${1:-0}" >"$_rc" + + test_cleanup "rm -f $_out $_rc" +} + +extra_footer () +{ + cat <&1) + else + _out=$("$@" 2>&1) + fi + _rc=$? + _out=$(echo "$_out" | $_sort ) + + # Get the return code back into $? + (exit $_rc) + + result_check +} diff --git a/ctdb/tests/UNIT/onnode/stubs/ctdb b/ctdb/tests/UNIT/onnode/stubs/ctdb new file mode 100755 index 0000000..cca34c5 --- /dev/null +++ b/ctdb/tests/UNIT/onnode/stubs/ctdb @@ -0,0 +1,19 @@ +#!/bin/sh + +# Fake ctdb client for onnode tests. + +out="${CTDB_TEST_TMP_DIR}/ctdb.out" +if [ -r "$out" ] ; then + cat "$out" + + rc="${CTDB_TEST_TMP_DIR}/ctdb.rc" + if [ -r "$rc" ] ; then + exit $(cat "$rc") + fi + + exit 0 +fi + +echo "fake ctdb: no implementation for \"$*\"" + +exit 1 diff --git a/ctdb/tests/UNIT/onnode/stubs/ssh b/ctdb/tests/UNIT/onnode/stubs/ssh new file mode 100755 index 0000000..7be778f --- /dev/null +++ b/ctdb/tests/UNIT/onnode/stubs/ssh @@ -0,0 +1,2 @@ +#!/bin/sh +echo "$*" diff --git a/ctdb/tests/UNIT/shellcheck/base_scripts.sh b/ctdb/tests/UNIT/shellcheck/base_scripts.sh new file mode 100755 index 0000000..cbb8502 --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/base_scripts.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "base scripts" + +shellcheck_test \ + "${CTDB_SCRIPTS_BASE}/ctdb-crash-cleanup.sh" \ + "${CTDB_SCRIPTS_BASE}/debug-hung-script.sh" \ + "${CTDB_SCRIPTS_BASE}/debug_locks.sh" \ + "${CTDB_SCRIPTS_BASE}/nfs-linux-kernel-callout" \ + "${CTDB_SCRIPTS_BASE}/statd-callout" diff --git a/ctdb/tests/UNIT/shellcheck/ctdb_helpers.sh b/ctdb/tests/UNIT/shellcheck/ctdb_helpers.sh new file mode 100755 index 0000000..f6c7e31 --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/ctdb_helpers.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "ctdb helpers" + +shellcheck_test \ + "${CTDB_SCRIPTS_TOOLS_HELPER_DIR}/ctdb_lvs" \ + "${CTDB_SCRIPTS_TOOLS_HELPER_DIR}/ctdb_natgw" diff --git a/ctdb/tests/UNIT/shellcheck/event_scripts.sh b/ctdb/tests/UNIT/shellcheck/event_scripts.sh new file mode 100755 index 0000000..dfb5ede --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/event_scripts.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "event scripts" + +shellcheck_test "${CTDB_SCRIPTS_DATA_DIR}/events/"*/[0-9][0-9].* diff --git a/ctdb/tests/UNIT/shellcheck/functions.sh b/ctdb/tests/UNIT/shellcheck/functions.sh new file mode 100755 index 0000000..7ce206d --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/functions.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "functions file" + +shellcheck_test -s sh "${CTDB_SCRIPTS_BASE}/functions" diff --git a/ctdb/tests/UNIT/shellcheck/init_script.sh b/ctdb/tests/UNIT/shellcheck/init_script.sh new file mode 100755 index 0000000..1e1d54c --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/init_script.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "init script" + +script="$CTDB_SCRIPTS_INIT_SCRIPT" + +if [ -z "$script" ] ; then + script="/etc/init.d/ctdb" + if [ ! -r "$script" ] ; then + script="/usr/local/etc/init.d/ctdb" + fi + if [ ! -r "$script" ] ; then + ctdb_test_skip "Unable to find ctdb init script" + fi +fi + +shellcheck_test "$script" diff --git a/ctdb/tests/UNIT/shellcheck/scripts/local.sh b/ctdb/tests/UNIT/shellcheck/scripts/local.sh new file mode 100644 index 0000000..07e72c3 --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/scripts/local.sh @@ -0,0 +1,33 @@ +# Hey Emacs, this is a -*- shell-script -*- !!! :-) + +. "${TEST_SCRIPTS_DIR}/script_install_paths.sh" + +define_test () +{ + _f=$(basename "$0" ".sh") + + printf "%-28s - %s\n" "$_f" "$1" +} +shellcheck_test () +{ + ok_null + if type shellcheck >/dev/null 2>&1 ; then + # Skip some recent checks: + # + # SC1090: Can't follow non-constant source. Use a + # directive to specify location. + # SC1091: Not following: FILE was not specified as + # input (see shellcheck -x). + # - Shellcheck doesn't handle our includes + # very well. Adding directives to handle + # include for both in-tree and installed + # cases just isn't going to be possible. + # SC2162: read without -r will mangle backslashes. + # - We never read things with backslashes, + # unnecessary churn. + _excludes="SC1090,SC1091,SC2162" + unit_test shellcheck --exclude="$_excludes" "$@" + else + ctdb_test_skip "shellcheck not installed" + fi +} diff --git a/ctdb/tests/UNIT/shellcheck/tests.sh b/ctdb/tests/UNIT/shellcheck/tests.sh new file mode 100755 index 0000000..f01ece7 --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/tests.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "tests" + +if "$CTDB_TESTS_ARE_INSTALLED" ; then + run_tests="${CTDB_SCRIPTS_TESTS_BIN_DIR}/ctdb_run_tests" + local_daemons="${CTDB_SCRIPTS_TESTS_BIN_DIR}/ctdb_local_daemons" +else + run_tests="${CTDB_TEST_DIR}/run_tests.sh" + local_daemons="${CTDB_TEST_DIR}/local_daemons.sh" +fi + +# Scripts +shellcheck_test \ + "$run_tests" \ + "$local_daemons" \ + "${TEST_SCRIPTS_DIR}/test_wrap" + +# Includes +shellcheck_test -s sh \ + "${TEST_SCRIPTS_DIR}/common.sh" \ + "${TEST_SCRIPTS_DIR}/script_install_paths.sh" \ + "${TEST_SCRIPTS_DIR}/unit.sh" + +shellcheck_test -s bash \ + "${TEST_SCRIPTS_DIR}/cluster.bash" \ + "${TEST_SCRIPTS_DIR}/integration.bash" \ + "${TEST_SCRIPTS_DIR}/integration_local_daemons.bash" \ + "${TEST_SCRIPTS_DIR}/integration_real_cluster.bash" diff --git a/ctdb/tests/UNIT/shellcheck/tools.sh b/ctdb/tests/UNIT/shellcheck/tools.sh new file mode 100755 index 0000000..2cd322c --- /dev/null +++ b/ctdb/tests/UNIT/shellcheck/tools.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "tools" + +shellcheck_test \ + "${CTDB_SCRIPTS_TOOLS_BIN_DIR}/onnode" \ + "${CTDB_SCRIPTS_TOOLS_BIN_DIR}/ctdb_diagnostics" diff --git a/ctdb/tests/UNIT/takeover/README b/ctdb/tests/UNIT/takeover/README new file mode 100644 index 0000000..764f389 --- /dev/null +++ b/ctdb/tests/UNIT/takeover/README @@ -0,0 +1,5 @@ +Unit tests for the CTDB IP allocation algorithm(s). + +Test case filenames look like .NNN.sh, where +indicates the IP allocation algorithm to use. These use the +ctdb_takeover_test test program. diff --git a/ctdb/tests/UNIT/takeover/det.001.sh b/ctdb/tests/UNIT/takeover/det.001.sh new file mode 100755 index 0000000..ead8f21 --- /dev/null +++ b/ctdb/tests/UNIT/takeover/det.001.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "3 nodes, 1 healthy" + +required_result < all healthy" + +required_result < 1 healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < 2 healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < all healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < all healthy, info logging" + +export CTDB_TEST_LOGLEVEL=INFO + +required_result < 192.168.20.253 -> 0 [+0] +${TEST_DATE_STAMP}1 [-105738] -> 192.168.20.251 -> 2 [+0] +${TEST_DATE_STAMP}1 [-88649] -> 192.168.21.253 -> 0 [+14161] +${TEST_DATE_STAMP}1 [-75448] -> 192.168.20.254 -> 2 [+15625] +${TEST_DATE_STAMP}1 [-59823] -> 192.168.20.250 -> 0 [+29786] +${TEST_DATE_STAMP}1 [-44198] -> 192.168.21.254 -> 2 [+28322] +192.168.21.254 2 +192.168.21.253 0 +192.168.21.252 1 +192.168.20.254 2 +192.168.20.253 0 +192.168.20.252 1 +192.168.20.251 2 +192.168.20.250 0 +192.168.20.249 1 +EOF + +simple_test 0,0,0 < all healthy, debug logging" + +export CTDB_TEST_LOGLEVEL=DEBUG + +required_result < 192.168.21.254 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-116718] -> 192.168.21.254 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-116971] -> 192.168.21.253 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-116971] -> 192.168.21.253 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-116971] -> 192.168.21.252 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-116971] -> 192.168.21.252 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-121110] -> 192.168.20.254 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-121110] -> 192.168.20.254 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.253 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.253 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.252 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.252 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.251 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.251 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.250 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-121363] -> 192.168.20.250 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-121110] -> 192.168.20.249 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-121110] -> 192.168.20.249 -> 2 [+0] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-121363] -> 192.168.20.253 -> 0 [+0] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [0] +${TEST_DATE_STAMP} 1 [417803] +${TEST_DATE_STAMP} 2 [0] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [417803] +${TEST_DATE_STAMP} 1 [-102557] -> 192.168.21.254 -> 0 [+14161] +${TEST_DATE_STAMP} 1 [-102557] -> 192.168.21.254 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-102810] -> 192.168.21.253 -> 0 [+14161] +${TEST_DATE_STAMP} 1 [-102810] -> 192.168.21.253 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-102810] -> 192.168.21.252 -> 0 [+14161] +${TEST_DATE_STAMP} 1 [-102810] -> 192.168.21.252 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-105234] -> 192.168.20.254 -> 0 [+15876] +${TEST_DATE_STAMP} 1 [-105234] -> 192.168.20.254 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-105234] -> 192.168.20.252 -> 0 [+16129] +${TEST_DATE_STAMP} 1 [-105234] -> 192.168.20.252 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-105738] -> 192.168.20.251 -> 0 [+15625] +${TEST_DATE_STAMP} 1 [-105738] -> 192.168.20.251 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-105738] -> 192.168.20.250 -> 0 [+15625] +${TEST_DATE_STAMP} 1 [-105738] -> 192.168.20.250 -> 2 [+0] +${TEST_DATE_STAMP} 1 [-105485] -> 192.168.20.249 -> 0 [+15625] +${TEST_DATE_STAMP} 1 [-105485] -> 192.168.20.249 -> 2 [+0] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-105738] -> 192.168.20.251 -> 2 [+0] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [0] +${TEST_DATE_STAMP} 1 [312065] +${TEST_DATE_STAMP} 2 [0] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [312065] +${TEST_DATE_STAMP} 1 [-88396] -> 192.168.21.254 -> 0 [+14161] +${TEST_DATE_STAMP} 1 [-88396] -> 192.168.21.254 -> 2 [+14161] +${TEST_DATE_STAMP} 1 [-88649] -> 192.168.21.253 -> 0 [+14161] +${TEST_DATE_STAMP} 1 [-88649] -> 192.168.21.253 -> 2 [+14161] +${TEST_DATE_STAMP} 1 [-88649] -> 192.168.21.252 -> 0 [+14161] +${TEST_DATE_STAMP} 1 [-88649] -> 192.168.21.252 -> 2 [+14161] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.254 -> 0 [+15876] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.254 -> 2 [+15625] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.252 -> 0 [+16129] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.252 -> 2 [+15625] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.250 -> 0 [+15625] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.250 -> 2 [+16129] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.249 -> 0 [+15625] +${TEST_DATE_STAMP} 1 [-89609] -> 192.168.20.249 -> 2 [+15876] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-88649] -> 192.168.21.253 -> 0 [+14161] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [14161] +${TEST_DATE_STAMP} 1 [223416] +${TEST_DATE_STAMP} 2 [0] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [223416] +${TEST_DATE_STAMP} 1 [-72520] -> 192.168.21.254 -> 0 [+30037] +${TEST_DATE_STAMP} 1 [-72520] -> 192.168.21.254 -> 2 [+14161] +${TEST_DATE_STAMP} 1 [-72520] -> 192.168.21.252 -> 0 [+30290] +${TEST_DATE_STAMP} 1 [-72520] -> 192.168.21.252 -> 2 [+14161] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.254 -> 0 [+30037] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.254 -> 2 [+15625] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.252 -> 0 [+30290] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.252 -> 2 [+15625] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.250 -> 0 [+29786] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.250 -> 2 [+16129] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.249 -> 0 [+29786] +${TEST_DATE_STAMP} 1 [-75448] -> 192.168.20.249 -> 2 [+15876] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-75448] -> 192.168.20.254 -> 2 [+15625] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [14161] +${TEST_DATE_STAMP} 1 [147968] +${TEST_DATE_STAMP} 2 [15625] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [147968] +${TEST_DATE_STAMP} 1 [-58359] -> 192.168.21.254 -> 0 [+30037] +${TEST_DATE_STAMP} 1 [-58359] -> 192.168.21.254 -> 2 [+28322] +${TEST_DATE_STAMP} 1 [-58359] -> 192.168.21.252 -> 0 [+30290] +${TEST_DATE_STAMP} 1 [-58359] -> 192.168.21.252 -> 2 [+28322] +${TEST_DATE_STAMP} 1 [-59572] -> 192.168.20.252 -> 0 [+30290] +${TEST_DATE_STAMP} 1 [-59572] -> 192.168.20.252 -> 2 [+31501] +${TEST_DATE_STAMP} 1 [-59823] -> 192.168.20.250 -> 0 [+29786] +${TEST_DATE_STAMP} 1 [-59823] -> 192.168.20.250 -> 2 [+31754] +${TEST_DATE_STAMP} 1 [-59823] -> 192.168.20.249 -> 0 [+29786] +${TEST_DATE_STAMP} 1 [-59823] -> 192.168.20.249 -> 2 [+31501] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-59823] -> 192.168.20.250 -> 0 [+29786] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [43947] +${TEST_DATE_STAMP} 1 [88145] +${TEST_DATE_STAMP} 2 [15625] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [88145] +${TEST_DATE_STAMP} 1 [-44198] -> 192.168.21.254 -> 0 [+44198] +${TEST_DATE_STAMP} 1 [-44198] -> 192.168.21.254 -> 2 [+28322] +${TEST_DATE_STAMP} 1 [-44198] -> 192.168.21.252 -> 0 [+44451] +${TEST_DATE_STAMP} 1 [-44198] -> 192.168.21.252 -> 2 [+28322] +${TEST_DATE_STAMP} 1 [-43947] -> 192.168.20.252 -> 0 [+45915] +${TEST_DATE_STAMP} 1 [-43947] -> 192.168.20.252 -> 2 [+31501] +${TEST_DATE_STAMP} 1 [-43947] -> 192.168.20.249 -> 0 [+45662] +${TEST_DATE_STAMP} 1 [-43947] -> 192.168.20.249 -> 2 [+31501] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-44198] -> 192.168.21.254 -> 2 [+28322] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [43947] +${TEST_DATE_STAMP} 1 [43947] +${TEST_DATE_STAMP} 2 [43947] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 0 [43947] +${TEST_DATE_STAMP} 0 [-28322] -> 192.168.21.253 -> 0 [+28322] +${TEST_DATE_STAMP} 0 [-28322] -> 192.168.21.253 -> 2 [+44198] +${TEST_DATE_STAMP} 0 [-29786] -> 192.168.20.253 -> 0 [+29786] +${TEST_DATE_STAMP} 0 [-29786] -> 192.168.20.253 -> 2 [+45662] +${TEST_DATE_STAMP} 0 [-29786] -> 192.168.20.250 -> 0 [+29786] +${TEST_DATE_STAMP} 0 [-29786] -> 192.168.20.250 -> 2 [+45915] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [43947] +${TEST_DATE_STAMP} 1 [-28322] -> 192.168.21.252 -> 0 [+44451] +${TEST_DATE_STAMP} 1 [-28322] -> 192.168.21.252 -> 2 [+44198] +${TEST_DATE_STAMP} 1 [-29786] -> 192.168.20.252 -> 0 [+45915] +${TEST_DATE_STAMP} 1 [-29786] -> 192.168.20.252 -> 2 [+45662] +${TEST_DATE_STAMP} 1 [-29786] -> 192.168.20.249 -> 0 [+45662] +${TEST_DATE_STAMP} 1 [-29786] -> 192.168.20.249 -> 2 [+45662] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 2 [43947] +${TEST_DATE_STAMP} 2 [-28322] -> 192.168.21.254 -> 0 [+44198] +${TEST_DATE_STAMP} 2 [-28322] -> 192.168.21.254 -> 2 [+28322] +${TEST_DATE_STAMP} 2 [-29786] -> 192.168.20.254 -> 0 [+45662] +${TEST_DATE_STAMP} 2 [-29786] -> 192.168.20.254 -> 2 [+29786] +${TEST_DATE_STAMP} 2 [-29786] -> 192.168.20.251 -> 0 [+45915] +${TEST_DATE_STAMP} 2 [-29786] -> 192.168.20.251 -> 2 [+29786] +${TEST_DATE_STAMP} ---------------------------------------- +192.168.21.254 2 +192.168.21.253 0 +192.168.21.252 1 +192.168.20.254 2 +192.168.20.253 0 +192.168.20.252 1 +192.168.20.251 2 +192.168.20.250 0 +192.168.20.249 1 +EOF + +simple_test 0,0,0 < 1 healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < 2 healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < all healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < all disconnected" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result <3 unhealthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result <4 unhealthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < 2 [+9216] +${TEST_DATE_STAMP} 130.216.30.173 -> 2 [+24345] +${TEST_DATE_STAMP} 130.216.30.171 -> 2 [+39970] +130.216.30.181 0 +130.216.30.180 1 +130.216.30.179 2 +130.216.30.178 3 +130.216.30.177 0 +130.216.30.176 1 +130.216.30.175 0 +130.216.30.174 1 +130.216.30.173 2 +130.216.30.172 3 +130.216.30.171 2 +130.216.30.170 3 +10.19.99.253 0 +10.19.99.252 1 +10.19.99.251 2 +10.19.99.250 3 +EOF + +# In this example were 4 releases from node 2 in a previous iteration +# +# Release of IP 130.216.30.179/27 on interface ethX1 node:3 +# Release of IP 130.216.30.173/27 on interface ethX1 node:0 +# Release of IP 130.216.30.171/27 on interface ethX1 node:1 +# Release of IP 10.19.99.251/22 on interface ethX2 node:0 +# +# However, one release failed so no takeovers were done. This means +# that the target node for each IP still thinks that the IPs are held +# by node 2. The release of 130.216.30.179 was so late that node 2 +# still thought that it held that address. + +simple_test 0,0,0,0 multi < 5 healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +required_result < 4 healthy" + +export CTDB_TEST_LOGLEVEL=DEBUG + +required_result < 130.216.30.178 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-64566] -> 130.216.30.176 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-64315] -> 130.216.30.175 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-64315] -> 130.216.30.171 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-52489] -> 10.19.99.253 -> 0 [+0] +${TEST_DATE_STAMP} 1 [-52489] -> 10.19.99.250 -> 0 [+0] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-64566] -> 130.216.30.178 -> 0 [+0] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [0] +${TEST_DATE_STAMP} 1 [116804] +${TEST_DATE_STAMP} 2 [128630] +${TEST_DATE_STAMP} 3 [128881] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 3 [128881] +${TEST_DATE_STAMP} 3 [-55099] -> 130.216.30.180 -> 0 [+15625] +${TEST_DATE_STAMP} 3 [-55099] -> 130.216.30.177 -> 0 [+15876] +${TEST_DATE_STAMP} 3 [-55350] -> 130.216.30.174 -> 0 [+15129] +${TEST_DATE_STAMP} 3 [-55350] -> 130.216.30.173 -> 0 [+15129] +${TEST_DATE_STAMP} 3 [-36864] -> 10.19.99.252 -> 0 [+9216] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}3 [-55350] -> 130.216.30.174 -> 0 [+15129] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [15129] +${TEST_DATE_STAMP} 1 [116804] +${TEST_DATE_STAMP} 2 [128630] +${TEST_DATE_STAMP} 3 [73531] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 2 [128630] +${TEST_DATE_STAMP} 2 [-55099] -> 130.216.30.181 -> 0 [+30754] +${TEST_DATE_STAMP} 2 [-55099] -> 130.216.30.179 -> 0 [+31258] +${TEST_DATE_STAMP} 2 [-55099] -> 130.216.30.172 -> 0 [+31005] +${TEST_DATE_STAMP} 2 [-55099] -> 130.216.30.170 -> 0 [+30754] +${TEST_DATE_STAMP} 2 [-36864] -> 10.19.99.251 -> 0 [+18432] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}2 [-55099] -> 130.216.30.181 -> 0 [+30754] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [45883] +${TEST_DATE_STAMP} 1 [116804] +${TEST_DATE_STAMP} 2 [73531] +${TEST_DATE_STAMP} 3 [73531] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [116804] +${TEST_DATE_STAMP} 1 [-48690] -> 130.216.30.176 -> 0 [+46630] +${TEST_DATE_STAMP} 1 [-49186] -> 130.216.30.175 -> 0 [+46387] +${TEST_DATE_STAMP} 1 [-49186] -> 130.216.30.171 -> 0 [+45883] +${TEST_DATE_STAMP} 1 [-43273] -> 10.19.99.253 -> 0 [+27648] +${TEST_DATE_STAMP} 1 [-43273] -> 10.19.99.250 -> 0 [+27648] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP}1 [-43273] -> 10.19.99.253 -> 0 [+27648] +${TEST_DATE_STAMP}+++++++++++++++++++++++++++++++++++++++++ +${TEST_DATE_STAMP}Selecting most imbalanced node from: +${TEST_DATE_STAMP} 0 [73531] +${TEST_DATE_STAMP} 1 [73531] +${TEST_DATE_STAMP} 2 [73531] +${TEST_DATE_STAMP} 3 [73531] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 0 [73531] +${TEST_DATE_STAMP} 0 [-39970] -> 130.216.30.181 -> 0 [+39970] +${TEST_DATE_STAMP} 0 [-39970] -> 130.216.30.178 -> 0 [+39970] +${TEST_DATE_STAMP} 0 [-39474] -> 130.216.30.174 -> 0 [+39474] +${TEST_DATE_STAMP} 0 [-27648] -> 10.19.99.253 -> 0 [+27648] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 1 [73531] +${TEST_DATE_STAMP} 1 [-39474] -> 130.216.30.176 -> 0 [+55846] +${TEST_DATE_STAMP} 1 [-39970] -> 130.216.30.175 -> 0 [+55603] +${TEST_DATE_STAMP} 1 [-39970] -> 130.216.30.171 -> 0 [+55099] +${TEST_DATE_STAMP} 1 [-27648] -> 10.19.99.250 -> 0 [+43273] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 2 [73531] +${TEST_DATE_STAMP} 2 [-39474] -> 130.216.30.179 -> 0 [+56099] +${TEST_DATE_STAMP} 2 [-39970] -> 130.216.30.172 -> 0 [+55350] +${TEST_DATE_STAMP} 2 [-39970] -> 130.216.30.170 -> 0 [+55099] +${TEST_DATE_STAMP} 2 [-27648] -> 10.19.99.251 -> 0 [+43273] +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} ---------------------------------------- +${TEST_DATE_STAMP} CONSIDERING MOVES FROM 3 [73531] +${TEST_DATE_STAMP} 3 [-39970] -> 130.216.30.180 -> 0 [+56099] +${TEST_DATE_STAMP} 3 [-39970] -> 130.216.30.177 -> 0 [+55846] +${TEST_DATE_STAMP} 3 [-39474] -> 130.216.30.173 -> 0 [+55350] +${TEST_DATE_STAMP} 3 [-27648] -> 10.19.99.252 -> 0 [+43777] +${TEST_DATE_STAMP} ---------------------------------------- +130.216.30.181 0 +130.216.30.180 3 +130.216.30.179 2 +130.216.30.178 0 +130.216.30.177 3 +130.216.30.176 1 +130.216.30.175 1 +130.216.30.174 0 +130.216.30.173 3 +130.216.30.172 2 +130.216.30.171 1 +130.216.30.170 2 +10.19.99.253 0 +10.19.99.252 3 +10.19.99.251 2 +10.19.99.250 1 +EOF + +simple_test 0,0,0,0 < continue node 3, all healthy" + +required_result < stop node 0" + +required_result < stop node 1" + +required_result < Stop node 2" + +required_result < stop node 3" + +required_result < node 0 stopped" + +required_result < node 1 stopped" + +required_result < node 2 stopped" + +required_result < node 3 stopped" + +required_result < 3 -> 4 healthy" + +export CTDB_TEST_LOGLEVEL=ERR + +set -e + +echo "Nodes 2, 3 disconnected -> node 2 attaches" + +required_result < all healthy" + +required_result < 0 [+0] + 10.0.0.33 -> 2 [+0] + 10.0.0.31 -> 0 [+14884] + 10.0.0.32 -> 2 [+16129] +RELEASE_IP 10.0.0.34 succeeded on 1 nodes +RELEASE_IP 10.0.0.33 succeeded on 1 nodes +RELEASE_IP 10.0.0.32 succeeded on 1 nodes +RELEASE_IP 10.0.0.31 succeeded on 1 nodes +TAKEOVER_IP 10.0.0.34 succeeded on node 0 +TAKEOVER_IP 10.0.0.33 succeeded on node 2 +TAKEOVER_IP 10.0.0.32 succeeded on node 2 +TAKEOVER_IP 10.0.0.31 succeeded on node 0 +IPREALLOCATED succeeded on 3 nodes +EOF +test_takeover_helper + +required_result 0 </dev/null || echo) + if [ -n "$pid" ] ; then + kill $pid || true + rm -f "$ctdbd_pidfile" + fi + rm -f "$ctdbd_socket" + rm -rf "$ctdbd_dbdir" +} + +setup_ctdbd () +{ + debug "Setting up fake ctdbd" + + mkdir -p "$ctdbd_dbdir" + $VALGRIND fake_ctdbd -d "$FAKE_CTDBD_DEBUGLEVEL" \ + -s "$ctdbd_socket" -p "$ctdbd_pidfile" \ + -D "$ctdbd_dbdir" + # This current translates to a 6 second timeout for the + # important controls + ctdb setvar TakeoverTimeout 2 + test_cleanup cleanup_ctdbd +} + +# Render non-printable characters. The helper prints the status as +# binary, so render it for easy comparison. +result_filter () +{ + sed -e 's|ctdb-takeover\[[0-9]*\]: ||' +} + +ctdb_cmd () +{ + echo Running: ctdb -d "$CTDB_DEBUGLEVEL" "$@" + ctdb -d "$CTDB_DEBUGLEVEL" "$@" +} + +test_ctdb_ip_all () +{ + unit_test ctdb -d "$CTDB_DEBUGLEVEL" ip all || exit $? +} + +takeover_helper_out="${CTDB_TEST_TMP_DIR}/takover_helper.out" + +takeover_helper_format_outfd () +{ + od -A n -t d4 "$takeover_helper_out" | sed -e 's|[[:space:]]*||g' +} + +test_takeover_helper () +{ + ( + export CTDB_DEBUGLEVEL="$HELPER_DEBUGLEVEL" + export CTDB_LOGGING="file:" + unit_test ctdb_takeover_helper 3 "$ctdbd_socket" "$@" \ + 3>"$takeover_helper_out" + ) || exit $? + + case "$required_rc" in + 255) _t="-1" ;; + *) _t="$required_rc" ;; + esac + ok "$_t" + + unit_test_notrace takeover_helper_format_outfd + _ret=$? + rm "$takeover_helper_out" + [ $_ret -eq 0 ] || exit $_ret +} diff --git a/ctdb/tests/UNIT/tool/README b/ctdb/tests/UNIT/tool/README new file mode 100644 index 0000000..8160528 --- /dev/null +++ b/ctdb/tests/UNIT/tool/README @@ -0,0 +1,17 @@ +Unit tests for the ctdb tool (i.e. tools/ctdb). + +Test case filenames can take 2 forms: + +* func..NNN.sh + + Run in the ctdb tool code using the + ctdb_tool_functest test program. This test program uses test stubs + for CTDB client functions. + +* stubby..NNN.sh + + Run the ctdb_tool_stubby test program with as the 1st + argument - subsequent are passed to simple_test(). ctdb_tool_stubby + is linked against the test stubs for CTDB client functions. + +To add tests here you may need to add appropriate test stubs. diff --git a/ctdb/tests/UNIT/tool/ctdb.attach.001.sh b/ctdb/tests/UNIT/tool/ctdb.attach.001.sh new file mode 100755 index 0000000..82c3332 --- /dev/null +++ b/ctdb/tests/UNIT/tool/ctdb.attach.001.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "attach volatile database" + +setup_ctdbd < down + +ok_null +simple_test eth1 down + +ok < up + +ok_null +simple_test eth1 up + +ok < down +ok_null +simple_test eth1 down + +ok < down + +ok_null +simple_test eth2 down + +ok < up + +ok_null +simple_test eth1 up + +ok </dev/null || echo) + if [ -n "$pid" ] ; then + kill $pid || true + rm -f "$ctdbd_pidfile" + fi + rm -f "$ctdbd_socket" + rm -rf "$ctdbd_dbdir" +} + +setup_ctdbd () +{ + echo "Setting up fake ctdbd" + + mkdir -p "$ctdbd_dbdir" + $VALGRIND fake_ctdbd -d "$FAKE_CTDBD_DEBUGLEVEL" \ + -s "$ctdbd_socket" -p "$ctdbd_pidfile" \ + -D "$ctdbd_dbdir" + # Wait till fake_ctdbd is running + wait_until 10 test -S "$ctdbd_socket" || \ + die "fake_ctdbd failed to start" + + test_cleanup cleanup_ctdbd +} + +ctdbd_getpid () +{ + cat "$ctdbd_pidfile" +} + +setup_natgw () +{ + debug "Setting up NAT gateway" + + export CTDB_NATGW_HELPER="${CTDB_SCRIPTS_TOOLS_HELPER_DIR}/ctdb_natgw" + export CTDB_NATGW_NODES="${CTDB_BASE}/natgw_nodes" + + cat >"$CTDB_NATGW_NODES" +} + +setup_lvs () +{ + debug "Setting up LVS" + + export CTDB_LVS_HELPER="${CTDB_SCRIPTS_TOOLS_HELPER_DIR}/ctdb_lvs" + export CTDB_LVS_NODES="${CTDB_BASE}/lvs_nodes" + + cat >"$CTDB_LVS_NODES" +} + +setup_nodes () +{ + _pnn="$1" + + _f="${CTDB_BASE}/nodes${_pnn:+.}${_pnn}" + + cat >"$_f" +} + +simple_test_other () +{ + unit_test $CTDB -d $CTDB_DEBUGLEVEL "$@" +} + +simple_test () +{ + simple_test_other $test_args "$@" +} -- cgit v1.2.3