Skip to content

Commit

Permalink
test(basex): set admin password before starting BaseX server
Browse files Browse the repository at this point in the history
  • Loading branch information
AirQuick committed May 9, 2023
1 parent df57873 commit 002d462
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions test/win-bats/collection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -772,9 +772,15 @@
rem BaseX dir
set "BASEX_HOME=%BASEX_JAR%\.."

rem Set BaseX password
rem Run the batch file in a child process in order to localize various environment changes
set BASEX_PASSWORD=%RANDOM%
call :run ""%BASEX_HOME%\bin\basex.bat" -c"PASSWORD %BASEX_PASSWORD%""
call :verify_retval 0

rem Start BaseX server
rem Run the batch file in a child process in order to localize various environment changes
call :run "%BASEX_HOME%\bin\basexhttp.bat" -S -U admin -c PASSWORD -h 8080
call :run "%BASEX_HOME%\bin\basexhttp.bat" -S
call :verify_retval 0

rem HTML report file
Expand All @@ -786,7 +792,7 @@
-o result="file:///%EXPECTED_REPORT:\=/%" ^
-p auth-method=Basic ^
-p endpoint=http://localhost:8080/rest ^
-p password=admin ^
-p password="%BASEX_PASSWORD%" ^
-p username=admin ^
-p xspec-home="file:///%PARENT_DIR_ABS:\=/%/" ^
..\src\harnesses\basex\basex-server-xquery-harness.xproc
Expand Down
8 changes: 6 additions & 2 deletions test/xspec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,12 @@ load bats-helper
# BaseX dir
basex_home=$(dirname -- "${BASEX_JAR}")

# Set BaseX password
basex_password=${RANDOM}
"${basex_home}/bin/basex" -c"PASSWORD ${basex_password}"

# Start BaseX server
"${basex_home}/bin/basexhttp" -S -U admin -c PASSWORD -h 8080
"${basex_home}/bin/basexhttp" -S

# HTML report file
expected_report="${work_dir}/report-sequence-result_${RANDOM}.html"
Expand All @@ -881,7 +885,7 @@ load bats-helper
-o result="file:${expected_report}" \
-p auth-method=Basic \
-p endpoint=http://localhost:8080/rest \
-p password=admin \
-p password="${basex_password}" \
-p username=admin \
-p xspec-home="file:${parent_dir_abs}/" \
../src/harnesses/basex/basex-server-xquery-harness.xproc
Expand Down

0 comments on commit 002d462

Please sign in to comment.