rsyslog/tests/yaml-basic-yamlonly.sh
Rainer Gerhards 5a78def249 testbench: queue timeouts via imdiag module params; yaml-only mode fixes and docs
- imdiag: add 5 module-scope config params to control key queue timeouts
  (mainmsgqueuetimeoutshutdown, mainmsgqueuetimeoutenqueue,
  inputshutdowntimeout, defaultactionqueuetimeoutshutdown,
  defaultactionqueuetimeoutenqueue); these replace per-test legacy
  $MainMsg* directives and eliminate races on slow machines (Solaris)
- imdiag: add assert(0) for unhandled params in setModCnf/newInpInst
- imdiag: modExit sets abortTimeout=-1 after joining timeoutGuard thread
  to prevent double-cancel if resetConfigVariables runs afterwards
- diag.sh: generate_conf --yaml-only flag for YAML-only test mode
- diag.sh: yaml preamble uses new imdiag module params
- diag.sh: add RSTB_MAIN_Q_TO_ENQUEUE separate from action queue var
- diag.sh: restore .started with instance-ID suffix for content_check
- diag.sh: wait_startup() uses imdiag port file for startup detection
- tests: add yaml-basic-yamlonly.sh smoke test
- doc: 6 new reference pages for new imdiag params (with meta blocks)
- doc: imdiag.rst updated with new module-scope params table
- doc: dev_testbench.rst corrected .started vs port-file description

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-29 17:26:39 +02:00

46 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Tests that the YAML-only testbench mode works end-to-end:
# - generate_conf --yaml-only writes a pure YAML preamble using
# testbench_modules: for the imdiag setup (no RainerScript)
# - test-specific modules go in a standard modules: section
# - add_yaml_imdiag_input adds the imdiag input for startup detection
# - rsyslogd starts and processes messages using only the YAML loader
#
# This test intentionally avoids any RainerScript or legacy-style directives
# so that it exercises the yaml-only testbench path.
#
# Added 2025 by contributors, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
require_plugin imtcp
export NUMMESSAGES=100
export QUEUE_EMPTY_CHECK_FUNC=wait_file_lines
generate_conf --yaml-only
# Test-specific modules go in a standard modules: section.
# Testbench infrastructure (imdiag) is in testbench_modules: written by the preamble.
add_yaml_conf 'modules:'
add_yaml_conf ' - load: "../plugins/imtcp/.libs/imtcp"'
add_yaml_conf ''
add_yaml_conf 'templates:'
add_yaml_conf ' - name: outfmt'
add_yaml_conf ' type: string'
add_yaml_conf " string: \"%msg:F,58:2%\\n\""
add_yaml_conf ''
add_yaml_conf 'inputs:'
add_yaml_imdiag_input
add_yaml_conf " - type: imtcp"
add_yaml_conf " port: \"0\""
add_yaml_conf " listenPortFileName: \"${RSYSLOG_DYNNAME}.tcpflood_port\""
add_yaml_conf " ruleset: main"
add_yaml_conf ''
add_yaml_conf 'rulesets:'
add_yaml_conf ' - name: main'
add_yaml_conf ' script: |'
add_yaml_conf " :msg, contains, \"msgnum:\" action(type=\"omfile\""
add_yaml_conf " template=\"outfmt\" file=\"${RSYSLOG_OUT_LOG}\")"
startup
tcpflood -m $NUMMESSAGES
shutdown_when_empty
wait_shutdown
seq_check
exit_test