-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: runtime_shell: custom_calyptia: add checks for fleet management
Signed-off-by: Patrick Stephens <[email protected]>
- Loading branch information
1 parent
bfacebb
commit 9e2234e
Showing
4 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[INPUT] | ||
name cpu | ||
tag cpu.local | ||
|
||
# Read interval (sec) Default: 1 | ||
interval_sec 1 | ||
|
||
[CUSTOM] | ||
name calyptia | ||
API_Key ${CALYPTIA_FLEET_TOKEN} | ||
Fleet_Name fluent-bit-ci-fleet | ||
fleet_config_legacy_format ${CALYPTIA_FLEET_FORMAT} | ||
fleet_config_dir ${CALYPTIA_FLEET_DIR} | ||
|
||
[OUTPUT] | ||
name null | ||
match * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
test_custom_calyptia_fleet_yaml() { | ||
[ -z "${CALYPTIA_FLEET_TOKEN:-}" ] && startSkipping | ||
|
||
export CALYPTIA_FLEET_TOKEN | ||
export CALYPTIA_FLEET_FORMAT="off" | ||
export CALYPTIA_FLEET_DIR="${CALYPTIA_FLEET_DIR:-/tmp/fleet-test}" | ||
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 | ||
fail 'Dry run failed' | ||
fi | ||
|
||
$FLB_BIN -c "$FLB_RUNTIME_SHELL_CONF/custom_calyptia_fleet.conf" & | ||
FLB_PID=$! | ||
|
||
# Allow us to register and retrieve fleet config | ||
sleep 30 | ||
|
||
# Check we have YAML files | ||
if find "$CALYPTIA_FLEET_DIR" -name '*.yaml' -type f -exec false {} +; then | ||
fail 'No YAML files found' | ||
fi | ||
|
||
# Check we are still running | ||
assertTrue 'Fluent bit not running' "[ kill -0 $FLB_PID ]" | ||
|
||
# Clean up | ||
kill -15 $FLB_PID | ||
} | ||
|
||
test_custom_calyptia_fleet_toml() { | ||
[ -z "${CALYPTIA_FLEET_TOKEN:-}" ] && startSkipping | ||
|
||
export CALYPTIA_FLEET_TOKEN | ||
export CALYPTIA_FLEET_FORMAT="on" | ||
export CALYPTIA_FLEET_DIR="${CALYPTIA_FLEET_DIR:-/tmp/fleet-test}" | ||
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 | ||
fail 'Dry run failed' | ||
fi | ||
|
||
$FLB_BIN -c "$FLB_RUNTIME_SHELL_CONF/custom_calyptia_fleet.conf" & | ||
FLB_PID=$! | ||
|
||
# Allow us to register and retrieve fleet config | ||
sleep 30 | ||
|
||
# Check we have no YAML files | ||
if ! find "$CALYPTIA_FLEET_DIR" -name '*.yaml' -type f -exec false {} +; then | ||
fail 'YAML files found' | ||
fi | ||
|
||
# Check we are still running | ||
assertTrue 'Fluent bit not running' "[ kill -0 $FLB_PID ]" | ||
|
||
# Clean up | ||
kill -15 $FLB_PID | ||
} | ||
|
||
# The following command launch the unit test | ||
# shellcheck source=/dev/null | ||
. "$FLB_RUNTIME_SHELL_PATH/runtime_shell.env" |