소스 검색

test: add some tests for EMQX boot failures

Zaiming (Stone) Shi 2 년 전
부모
커밋
75817e23bd
1개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 21 0
      scripts/test/emqx-boot.bats

+ 21 - 0
scripts/test/emqx-boot.bats

@@ -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
+}