1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

ctdb-event: Switch to ETIMEDOUT instead of ETIME

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Amitay Isaacs 2018-07-10 18:34:13 +10:00 committed by Martin Schwenke
parent a42a723299
commit c8756ec17b
20 changed files with 43 additions and 46 deletions

View File

@ -130,8 +130,8 @@ static void event_cmd_run_done(struct tevent_req *subreq)
goto done;
}
if (script_list->summary == -ETIME) {
state->reply->result = ETIME;
if (script_list->summary == -ETIMEDOUT) {
state->reply->result = ETIMEDOUT;
} else if (script_list->summary != 0) {
state->reply->result = ENOEXEC;
}

View File

@ -145,7 +145,7 @@ static int event_command_run(TALLOC_CTX *mem_ctx,
if (result == ENOENT) {
printf("Event dir for %s does not exist\n", argv[1]);
} else if (result == ETIME) {
} else if (result == ETIMEDOUT) {
printf("Event %s in %s timed out\n", argv[2], argv[1]);
} else if (result == ECANCELED) {
printf("Event %s in %s got cancelled\n", argv[2], argv[1]);
@ -170,7 +170,7 @@ static double timeval_delta(struct timeval *tv2, struct timeval *tv)
static void print_status_one(struct ctdb_event_script *script)
{
if (script->result == -ETIME) {
if (script->result == -ETIMEDOUT) {
printf("%-20s %-10s %s",
script->name,
"TIMEDOUT",

View File

@ -6,17 +6,17 @@ define_test "non-existent eventscript directory"
setup_eventd
required_result 2 <<EOF
required_error ENOENT <<EOF
Event dir for foobar does not exist
EOF
simple_test status foobar monitor
required_result 2 <<EOF
required_error ENOENT <<EOF
Event dir for foobar does not exist
EOF
simple_test run 10 foobar monitor
required_result 2 <<EOF
required_error ENOENT <<EOF
Script 01.test does not exist in foobar
EOF
simple_test script enable foobar 01.test

View File

@ -6,16 +6,14 @@ define_test "empty eventscript directory"
setup_eventd
required_result 22 <<EOF
required_error EINVAL <<EOF
Event monitor has never run in empty
EOF
simple_test status empty monitor
ok <<EOF
EOF
ok_null
simple_test run 10 empty monitor
ok <<EOF
EOF
ok_null
simple_test status empty monitor

View File

@ -6,28 +6,27 @@ define_test "eventscript directory with random files"
setup_eventd
required_result 22 <<EOF
required_error EINVAL <<EOF
Script README is invalid in random
EOF
simple_test script enable random README
required_result 22 <<EOF
required_error EINVAL <<EOF
Script a is invalid in random
EOF
simple_test script disable random a
required_result 2 <<EOF
required_error ENOENT <<EOF
Script 00.foobar does not exist in random
EOF
simple_test script enable random 00.foobar
required_result 22 <<EOF
required_error EINVAL <<EOF
Event monitor has never run in random
EOF
simple_test status random monitor
ok <<EOF
EOF
ok_null
simple_test run 10 random monitor
ok <<EOF

View File

@ -18,7 +18,7 @@ simple_test script enable random 01.disabled
ok_null
simple_test script disable random 01.disabled
required_result 22 <<EOF
required_error EINVAL <<EOF
Event monitor has never run in random
EOF
simple_test status random monitor

View File

@ -6,7 +6,7 @@ define_test "failing event script"
setup_eventd
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event failure in random failed
EOF
simple_test run 10 random failure

View File

@ -6,12 +6,12 @@ define_test "timing out event script"
setup_eventd
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event timeout in random timed out
EOF
simple_test run 5 random timeout
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
01.disabled DISABLED
02.enabled TIMEDOUT DATETIME
OUTPUT:

View File

@ -15,7 +15,7 @@ ok <<EOF
EOF
simple_test status random monitor
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event failure in random failed
EOF
simple_test run 10 random failure
@ -27,7 +27,7 @@ required_result 1 <<EOF
EOF
simple_test status random failure
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event verbosefailure in random failed
EOF
simple_test run 10 random verbosefailure

View File

@ -9,7 +9,7 @@ setup_eventd
ok_null
simple_test_background run 10 multi startup
required_result 125 <<EOF
required_error ECANCELED <<EOF
Event monitor in multi got cancelled
EOF
simple_test run 10 multi monitor
@ -21,7 +21,7 @@ ok <<EOF
EOF
simple_test status multi startup
required_result 22 <<EOF
required_error EINVAL <<EOF
Event monitor has never run in multi
EOF
simple_test status multi monitor

View File

@ -6,7 +6,7 @@ define_test "cancel running monitor event"
setup_eventd
required_result 125 <<EOF
required_error ECANCELED <<EOF
Event monitor in multi got cancelled
EOF
simple_test_background run 10 multi monitor
@ -21,7 +21,7 @@ ok <<EOF
EOF
simple_test status multi startup
required_result 22 <<EOF
required_error EINVAL <<EOF
Event monitor has never run in multi
EOF
simple_test status multi monitor

View File

@ -12,7 +12,7 @@ result_filter ()
sed -e "s| ${_pid}| PID|"
}
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event timeout in random timed out
EOF
simple_test run 5 random timeout

View File

@ -6,7 +6,7 @@ define_test "status output in debug script"
setup_eventd
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event verbosetimeout in random timed out
EOF
simple_test run 5 random verbosetimeout

View File

@ -6,7 +6,7 @@ define_test "redirected status output in debug script"
setup_eventd
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event verbosetimeout2 in random timed out
EOF
simple_test run 5 random verbosetimeout2

View File

@ -12,7 +12,7 @@ result_filter()
sed -e "s|${_pid}|PID|"
}
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event timeout in random timed out
EOF
simple_test run 5 random timeout

View File

@ -6,7 +6,7 @@ define_test "failures with multiple scripts"
setup_eventd
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event event1 in multi failed
EOF
simple_test run 10 multi event1
@ -18,7 +18,7 @@ required_result 1 <<EOF
EOF
simple_test status multi event1
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event event2 in multi failed
EOF
simple_test run 10 multi event2
@ -31,7 +31,7 @@ required_result 2 <<EOF
EOF
simple_test status multi event2
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event event3 in multi failed
EOF
simple_test run 10 multi event3

View File

@ -6,35 +6,35 @@ define_test "timeouts with multiple scripts"
setup_eventd
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event timeout1 in multi timed out
EOF
simple_test run 5 multi timeout1
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
01.test TIMEDOUT DATETIME
OUTPUT:
EOF
simple_test status multi timeout1
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event timeout2 in multi timed out
EOF
simple_test run 5 multi timeout2
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
01.test OK DURATION DATETIME
02.test TIMEDOUT DATETIME
OUTPUT:
EOF
simple_test status multi timeout2
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event timeout3 in multi timed out
EOF
simple_test run 5 multi timeout3
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
01.test OK DURATION DATETIME
02.test OK DURATION DATETIME
03.test TIMEDOUT DATETIME

View File

@ -9,7 +9,7 @@ setup_eventd
ok_null
simple_test_background run 10 multi monitor
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event failure in random failed
EOF
simple_test run 10 random failure

View File

@ -9,7 +9,7 @@ setup_eventd
ok_null
simple_test_background run 10 multi monitor
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
Event timeout in random timed out
EOF
simple_test run 10 random timeout
@ -21,7 +21,7 @@ ok <<EOF
EOF
simple_test status multi monitor
required_result 62 <<EOF
required_error ETIMEDOUT <<EOF
01.disabled DISABLED
02.enabled TIMEDOUT DATETIME
OUTPUT:

View File

@ -8,7 +8,7 @@ setup_eventd
export CTDB_EVENT_RUN_ALL=1
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event event1 in multi failed
EOF
simple_test run 10 multi event1
@ -21,7 +21,7 @@ required_result 1 <<EOF
EOF
simple_test status multi event1
required_result 8 <<EOF
required_error ENOEXEC <<EOF
Event event2 in multi failed
EOF
simple_test run 10 multi event2