-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scripts for running locally in docker and adjust SqlServer to match o…
…thers (#266) - Adds some scripts to ease running tests locally in docker containers. - Adjusts SqlServer patterns to match other DBs.
- Loading branch information
Showing
15 changed files
with
130 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Docker Use | ||
|
||
Scripts in this directory can be used to quickly run a benchmark against a sample database. | ||
|
||
For instance: | ||
|
||
```bash | ||
# Set which database to target. | ||
export BENCHBASE_PROFILE='sqlserver' | ||
# Set which profiles to build. | ||
export BENCHBASE_PROFILES=$BENCHBASE_PROFILE | ||
# Whether or not to rebuild the package/image. | ||
export CLEAN_BUILD="false" | ||
# When rebuilding, whether or not to run the unit tests. | ||
export SKIP_TESTS="true" | ||
|
||
# Set which benchmark to run. | ||
benchmark='tpcc' | ||
|
||
./docker/build-run-benchmark-with-docker.sh $benchmark | ||
``` | ||
|
||
This will use the selected profile's `up.sh` script to start the database as a local container, and the [`run-full-image.sh`](./benchbase/run-full-image.sh) to optionally build benchbase and then run the benchmark against it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
set -x | ||
|
||
benchmark="${1:-noop}" | ||
|
||
# Let these pass through from the .env file from the devcontainer. | ||
export BENCHBASE_PROFILE="${BENCHBASE_PROFILE:-postgres}" | ||
export BENCHBASE_PROFILES="$BENCHBASE_PROFILE" | ||
|
||
# When we are running the full image we don't generally want to have to rebuild it repeatedly. | ||
export CLEAN_BUILD="${CLEAN_BUILD:-false}" | ||
|
||
# Move to the repo root. | ||
scriptdir=$(dirname "$(readlink -f "$0")") | ||
rootdir=$(readlink -f "$scriptdir/..") | ||
cd "$rootdir" | ||
|
||
if [ ! -x "docker/${BENCHBASE_PROFILE}-latest/up.sh" ]; then | ||
echo "ERROR: No docker up.sh script available for '$BENCHBASE_PROFILE'" | ||
fi | ||
|
||
pushd "docker/${BENCHBASE_PROFILE}-latest" | ||
./up.sh | ||
popd | ||
|
||
SKIP_TESTS=${SKIP_TESTS:-true} EXTRA_DOCKER_ARGS="--network=host" \ | ||
./docker/benchbase/run-full-image.sh \ | ||
--config "config/sample_${benchmark}_config.xml" --bench "$benchmark" \ | ||
--create=true --load=true --execute=true \ | ||
--sample 1 --interval-monitor 1000 \ | ||
--json-histograms results/histograms.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
docker compose up -d | ||
|
||
network=$(docker ps --format "{{.Names}} {{.Networks}}" | awk '( $1 ~ /^'$BENCHBASE_PROFILE'/ ) { print $2 }') | ||
|
||
# Also setup the database for use with the sample configs. | ||
# See Also: .github/workflows/maven.yml | ||
|
||
function run_sqlcmd_in_docker() { | ||
set -x | ||
docker run --rm --network=$network --entrypoint /opt/mssql-tools/bin/sqlcmd mcr.microsoft.com/mssql-tools:latest \ | ||
-U sa -P SApassword1 -S sqlserver -b "$@" | ||
set +x | ||
} | ||
|
||
# Cleanup database | ||
run_sqlcmd_in_docker -Q "DROP DATABASE IF EXISTS benchbase;" | ||
|
||
# Setup database | ||
run_sqlcmd_in_docker -Q "CREATE DATABASE benchbase;" | ||
|
||
# Setup login | ||
run_sqlcmd_in_docker -Q "CREATE LOGIN benchuser01 WITH PASSWORD='P@ssw0rd';" || true | ||
|
||
# Setup access | ||
run_sqlcmd_in_docker -Q "USE benchbase; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01';" || true |