File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed
Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -117,19 +117,34 @@ determine_network_directory() {
117117# Start the replica in the background.
118118dfx_start () {
119119 local port dfx_config_root webserver_port
120-
121- # Start on random port for parallel test execution
122- FRONTEND_HOST=" 127.0.0.1:0"
120+ local args=( " $@ " )
121+
122+ add_default_parameter () {
123+ local param_name=$1
124+ local param_value=$2
125+ local has_param=false
126+ for arg in " ${args[@]} " ; do
127+ if [[ $arg == " $param_name " ]]; then
128+ has_param=true
129+ break
130+ fi
131+ done
132+ if ! $has_param ; then
133+ args+=( " $param_name " " $param_value " )
134+ fi
135+ }
136+
137+ # By default, start on random port for parallel test execution
138+ add_default_parameter " --host" " 127.0.0.1:0"
139+
140+ add_default_parameter " --artificial-delay" " 100"
123141
124142 determine_network_directory
143+
125144 # Bats creates a FD 3 for test output, but child processes inherit it and Bats will
126145 # wait for it to close. Because `dfx start` leaves child processes running, we need
127146 # to close this pipe, otherwise Bats will wait indefinitely.
128- if [[ $# -eq 0 ]]; then
129- dfx start --background --host " $FRONTEND_HOST " --artificial-delay 100 3>& - # Start on random port for parallel test execution
130- else
131- dfx start --background --artificial-delay 100 " $@ " 3>& -
132- fi
147+ dfx start --background " ${args[@]} " 3>& -
133148
134149 dfx_config_root=" $E2E_NETWORK_DATA_DIRECTORY /replica-configuration"
135150 printf " Configuration Root for DFX: %s\n" " ${dfx_config_root} "
You can’t perform that action at this time.
0 commit comments