Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
exbotanical committed Jan 21, 2025
1 parent 871b5f4 commit d85b635
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
3 changes: 2 additions & 1 deletion scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ if [ "$(echo "$ret" | grep 'not ok')" != "" ]; then
exit 1
fi

make -s integ_test 2>/dev/null
make -s integ_test
# TODO: 2>/dev/null
exit $?
9 changes: 7 additions & 2 deletions src/api/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static hash_table* command_handlers_map;
static void
write_jobs_command (int client_fd) {
write(client_fd, "[", 1);

unsigned int len = array_size(job_queue);
foreach (job_queue, i) {
job_t* job = (job_t*)array_get_or_panic(job_queue, i);
Expand Down Expand Up @@ -82,16 +83,19 @@ write_crontabs_command (int client_fd) {
char* cmd_esc = escape_json_string(ce->cmd);

char* s = s_fmt(
"{\"id\":\"%d\",\"cmd\":\"%s\",\"schedule\":\"%s\",\"owner\":\"%s\","
"{\"id\":\"%d\",\"filepath\":\"%s\",\"cmd\":\"%s\",\"schedule\":\"%s\","
"\"owner\":\"%s\","
"\"envp\":\"%s\",\"next\":\"%s\"}%s",
ce->id,
entry->key,
cmd_esc,
ce->schedule,
ct->uname,
se,
ts,
entries != 0 || i != len - 1 ? "," : ""
entries != 0 ? "," : ""
);
log_debug(">>>> %s\n", s);

write(client_fd, s, strlen(s));

Expand All @@ -101,6 +105,7 @@ write_crontabs_command (int client_fd) {
free(ts);
}
HT_ITER_END
log_debug(">>>> %s\n", "DONE FEWL");

write(client_fd, "]", 1);
}
Expand Down
9 changes: 6 additions & 3 deletions t/integ/ipc_shpec.bash
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ describe 'ipc API IPC_SHOW_INFO command'
end_describe

describe 'ipc API IPC_LIST_CRONTABS command'
n_syscrontabs="$(find /etc/cron.{hourly,daily,weekly,monthly} -type f 2>/dev/null | wc -l)"
n_syscrontabs="$(find /etc/cron.{hourly,daily,weekly,monthly} -type f 2>/dev/null | wc -l)"
start_chronic
sleep 5

out="$(sock_call '{ "command" : "IPC_LIST_CRONTABS"}' 2>/dev/null | tr -d '\0')"
out="$(sock_call '{ "command" : "IPC_LIST_CRONTABS"}')"
echo ">>>>> $out"
cat .log

it 'lists all crontabs'
assert equal $(jq 'length' <<< "$out") "$((n_syscrontabs + 3))"
Expand All @@ -177,7 +179,8 @@ describe 'ipc API IPC_LIST_JOBS command'
echo 'sleeping for 60 seconds...'
sleep 60

out="$(sock_call '{ "command" : "IPC_LIST_JOBS"}' 2>/dev/null | tr -d '\0')"
out="$(sock_call '{ "command" : "IPC_LIST_JOBS"}')"
echo ">>> $out"

it 'lists all jobs'
assert gt "$(jq 'length' <<< "$out")" 0
Expand Down
10 changes: 5 additions & 5 deletions t/integ/utils/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ TESTING_DIR=t/integ
UTILS_F=run_utils.bash

declare -a SKIP_FILES=(
# 'daemon_shpec.bash'
'daemon_shpec.bash'
# 'ipc_shpec.bash'
# 'peripherals_shpec.bash'
# 'root_shpec.bash'
# 'sig_shpec.bash'
# 'user_shpec.bash'
'peripherals_shpec.bash'
'root_shpec.bash'
'sig_shpec.bash'
'user_shpec.bash'
)

run_test () {
Expand Down

0 comments on commit d85b635

Please sign in to comment.