File tree Expand file tree Collapse file tree 3 files changed +41
-5
lines changed Expand file tree Collapse file tree 3 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,24 @@ ERLANG_MK_COMMIT = rabbitmq-tmp
149
149
include rabbitmq-components.mk
150
150
include erlang.mk
151
151
152
+ ifeq ($(strip $(BATS ) ) ,)
153
+ BATS := $(ERLANG_MK_TMP ) /bats/bin/bats
154
+ endif
155
+
156
+ BATS_GIT ?= https://github.com/sstephenson/bats
157
+ BATS_COMMIT ?= v0.4.0
158
+
159
+ $(BATS ) :
160
+ $(verbose ) mkdir -p $(ERLANG_MK_TMP )
161
+ $(gen_verbose ) git clone --depth 1 --branch=$(BATS_COMMIT ) $(BATS_GIT ) $(ERLANG_MK_TMP ) /bats
162
+
163
+ .PHONY : bats
164
+
165
+ bats : $(BATS )
166
+ $(verbose ) $(BATS ) $(TEST_DIR )
167
+
168
+ tests :: bats
169
+
152
170
SLOW_CT_SUITES := backing_queue \
153
171
cluster_rename \
154
172
clustering_management \
Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ RABBITMQ_HOME="$(rmq_realpath "${RABBITMQ_SCRIPTS_DIR}/..")"
76
76
# # Set defaults
77
77
. ${RABBITMQ_SCRIPTS_DIR} /rabbitmq-defaults
78
78
79
+ # # Get configuration variables from the configure environment file
80
+ [ " x" = " x$RABBITMQ_CONF_ENV_FILE " ] && RABBITMQ_CONF_ENV_FILE=${CONF_ENV_FILE}
81
+ [ -f ${RABBITMQ_CONF_ENV_FILE} ] && . ${RABBITMQ_CONF_ENV_FILE} || true
82
+
79
83
DEFAULT_SCHEDULER_BIND_TYPE=" db"
80
84
[ " x" = " x$RABBITMQ_SCHEDULER_BIND_TYPE " ] && RABBITMQ_SCHEDULER_BIND_TYPE=${DEFAULT_SCHEDULER_BIND_TYPE}
81
85
@@ -90,11 +94,6 @@ SERVER_ERL_ARGS="+P 1048576 +t 5000000 +stbt $RABBITMQ_SCHEDULER_BIND_TYPE +zdbb
90
94
# it and warn the user.
91
95
saved_RABBITMQ_PID_FILE=$RABBITMQ_PID_FILE
92
96
93
- # # Get configuration variables from the configure environment file
94
- [ " x" = " x$RABBITMQ_CONF_ENV_FILE " ] && RABBITMQ_CONF_ENV_FILE=${CONF_ENV_FILE}
95
-
96
- [ -f ${RABBITMQ_CONF_ENV_FILE} ] && . ${RABBITMQ_CONF_ENV_FILE} || true
97
-
98
97
if [ " $saved_RABBITMQ_PID_FILE " -a \
99
98
" $saved_RABBITMQ_PID_FILE " != " $RABBITMQ_PID_FILE " ]; then
100
99
echo " WARNING: RABBITMQ_PID_FILE was already set by the init script to:" 1>&2
Original file line number Diff line number Diff line change
1
+ @test " can set RABBITMQ_SCHEDULER_BIND_TYPE from rabbitmq-env.conf" {
2
+ declare -r scripts_dir=" $BATS_TEST_DIRNAME /../scripts"
3
+ export RABBITMQ_SCRIPTS_DIR=" $scripts_dir "
4
+ export RABBITMQ_CONF_ENV_FILE=" $BATS_TMPDIR /rabbitmq-env.conf"
5
+ echo ' RABBITMQ_SCHEDULER_BIND_TYPE=u' > " $RABBITMQ_CONF_ENV_FILE "
6
+ source " $scripts_dir /rabbitmq-env"
7
+ echo " expect RABBITMQ_SERVER_ERL_ARGS to contain '+stbt u' but got '$SERVER_ERL_ARGS '"
8
+ [[ $RABBITMQ_SERVER_ERL_ARGS == * +stbt\ u* ]]
9
+ }
10
+
11
+ @test " can set RABBITMQ_DISTRIBUTION_BUFFER_SIZE from rabbitmq-env.conf" {
12
+ declare -r scripts_dir=" $BATS_TEST_DIRNAME /../scripts"
13
+ export RABBITMQ_SCRIPTS_DIR=" $scripts_dir "
14
+ export RABBITMQ_CONF_ENV_FILE=" $BATS_TMPDIR /rabbitmq-env.conf"
15
+ echo ' RABBITMQ_DISTRIBUTION_BUFFER_SIZE=123456' > " $RABBITMQ_CONF_ENV_FILE "
16
+ source " $scripts_dir /rabbitmq-env"
17
+ echo " expect RABBITMQ_SERVER_ERL_ARGS to contain '+zdbbl 123456' but got '$SERVER_ERL_ARGS '"
18
+ [[ $RABBITMQ_SERVER_ERL_ARGS == * +zdbbl\ 123456* ]]
19
+ }
You can’t perform that action at this time.
0 commit comments