test: add some tests for EMQX boot failures

This commit is contained in:
Zaiming (Stone) Shi 2023-03-30 14:03:23 +02:00
parent 494e4b639a
commit 75817e23bd
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#!/usr/bin/env bats
# https://github.com/bats-core/bats-core
# env PROFILE=emqx bats -t -p --verbose-run scripts/test/emqx-boot.bats
@test "PROFILE must be set" {
[[ -n "$PROFILE" ]]
}
@test "emqx boot with invalid node name" {
output="$(env EMQX_NODE_NAME="invliadename#" ./_build/$PROFILE/rel/emqx/bin/emqx console 2>&1|| true)"
[[ "$output" =~ "ERROR: Invalid node name,".+ ]]
}
@test "corrupted cluster config file" {
conffile="./_build/$PROFILE/rel/emqx/data/configs/cluster-override.conf"
echo "{" > $conffile
run ./_build/$PROFILE/rel/emqx/bin/emqx console
[[ $status -ne 0 ]]
rm -f $conffile
}