From 6c0b8d7724af43ef66d10a5db4bb3c22960ddaf6 Mon Sep 17 00:00:00 2001 From: Patrick Stephens Date: Tue, 17 Dec 2024 16:45:42 +0000 Subject: [PATCH] tests: runtime_shell: custom_calyptia: fix checks Signed-off-by: Patrick Stephens --- tests/runtime_shell/custom_calyptia.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/runtime_shell/custom_calyptia.sh b/tests/runtime_shell/custom_calyptia.sh index 396bf76f508..5ee81745eb0 100755 --- a/tests/runtime_shell/custom_calyptia.sh +++ b/tests/runtime_shell/custom_calyptia.sh @@ -9,7 +9,7 @@ test_custom_calyptia_fleet_yaml() { rm -rf "$CALYPTIA_FLEET_DIR" # Dry-run to check it is valid - if $FLB_BIN -c "$FLB_RUNTIME_SHELL_CONF/custom_calyptia_fleet.conf" --dry-run; then + if ! $FLB_BIN -c "$FLB_RUNTIME_SHELL_CONF/custom_calyptia_fleet.conf" --dry-run; then fail 'Dry run failed' fi @@ -22,10 +22,12 @@ test_custom_calyptia_fleet_yaml() { # Check we have YAML files if find "$CALYPTIA_FLEET_DIR" -name '*.yaml' -type f -exec false {} +; then fail 'No YAML files found' + else + find "$CALYPTIA_FLEET_DIR" -name '*.yaml' -type f -exec cat {} \; fi # Check we are still running - assertTrue 'Fluent bit not running' "[ kill -0 $FLB_PID ]" + assertTrue 'Fluent bit not running' "$(kill -0 $FLB_PID)" # Clean up kill -15 $FLB_PID @@ -40,7 +42,7 @@ test_custom_calyptia_fleet_toml() { rm -rf "$CALYPTIA_FLEET_DIR" # Dry-run to check it is valid - if $FLB_BIN -c "$FLB_RUNTIME_SHELL_CONF/custom_calyptia_fleet.conf" --dry-run; then + if ! $FLB_BIN -c "$FLB_RUNTIME_SHELL_CONF/custom_calyptia_fleet.conf" --dry-run; then fail 'Dry run failed' fi @@ -51,12 +53,14 @@ test_custom_calyptia_fleet_toml() { sleep 30 # Check we have no YAML files - if ! find "$CALYPTIA_FLEET_DIR" -name '*.yaml' -type f -exec false {} +; then + if find "$CALYPTIA_FLEET_DIR" -name '*.yaml' -type f -exec false {} +; then + echo 'No YAML files found' + else fail 'YAML files found' fi # Check we are still running - assertTrue 'Fluent bit not running' "[ kill -0 $FLB_PID ]" + assertTrue 'Fluent bit not running' "$(kill -0 $FLB_PID)" # Clean up kill -15 $FLB_PID