-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds IT tests for different versions of MSSQL servers
This test extends the MSSQL integration tests by adding test for running the existing test suite against the following MSSQL server versions: - 2019-latest - 2017-CU1-ubuntu in addition to the `2017-latest` version that is used in the existing test. The integration tests for each new server version have been added in their own subdirectory in the MSSQL test directory. This will allow for different server versions to be incrementally added/removed over time without affecting the default testing that uses MSSQL server version 2017-latest. Each MSSQL server version test subdirectory has its own versions of docker-compose.yml and secretless.yml that use different values of host ports for the various services so that they can run concurrently. Each subdirectory also has versions of the 'start', 'stop', 'test', 'test-local', and 'wait_for_mssql' scripts, but these scripts mostly delegate to their counterparts in the parent test directory (so that any changes to scripts in the parent directory will not have to be duplicated in the subdirectories). Addresses serverless-broker Issue #1017.
- Loading branch information
diverdane
committed
Dec 20, 2019
1 parent
7389ec5
commit 81817f5
Showing
23 changed files
with
308 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash -ex | ||
|
||
./start -d |
48 changes: 48 additions & 0 deletions
48
test/connector/tcp/mssql/mssql-2017-CU1/docker-compose.yml
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,48 @@ | ||
version: '3.0' | ||
|
||
services: | ||
|
||
mssql-2017-CU1: | ||
image: mcr.microsoft.com/mssql/server:2017-CU1-ubuntu | ||
ports: | ||
- 1434:1433 | ||
environment: | ||
# This hardcoded password must match the one in secretless.yml. | ||
SA_PASSWORD: "yourStrong()Password" | ||
ACCEPT_EULA: Y | ||
|
||
secretless-2017-CU1: | ||
image: secretless-broker | ||
ports: | ||
- 2224:2223 | ||
volumes: | ||
- ./secretless.yml:/secretless.yml | ||
depends_on: | ||
- mssql-2017-CU1 | ||
|
||
secretless-2017-CU1-dev: | ||
image: secretless-dev | ||
command: ./bin/reflex | ||
ports: | ||
- 2224:2223 | ||
volumes: | ||
- ../../../../..:/secretless | ||
- ./secretless.yml:/secretless.yml | ||
depends_on: | ||
- mssql-2017-CU1 | ||
|
||
test: | ||
build: | ||
context: .. | ||
command: sleep 999d | ||
environment: | ||
TEST_ROOT: /secretless/test/connector/tcp/mssql | ||
DB_PROTOCOL: mssql | ||
DB_HOST_TLS: mssql-2017-CU1 | ||
DB_HOST_NO_TLS: mssql-2017-CU1 # TODO: configure a non-ssl container? | ||
DB_PORT: 1433 | ||
DB_USER: sa | ||
DB_PASSWORD: yourStrong()Password | ||
SECRETLESS_HOST: | ||
volumes: | ||
- ../../../../..:/secretless |
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,12 @@ | ||
version: 2 | ||
|
||
services: | ||
mssql: | ||
connector: mssql | ||
listenOn: tcp://0.0.0.0:2223 | ||
credentials: | ||
username: sa | ||
# This hardcoded password must match the one in the docker-compose. | ||
password: yourStrong()Password | ||
host: mssql-2017-CU1 | ||
port: 1433 |
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,12 @@ | ||
#!/bin/bash -ex | ||
|
||
mssql_host="mssql-2017-CU1" | ||
secretless_host="secretless-2017-CU1" | ||
while getopts ":d" opt; do | ||
case $opt in | ||
d) secretless_host=secretless-2017-CU1-dev;; | ||
*) echo "Unknown option -$OPTARG"; exit 1;; | ||
esac | ||
done | ||
|
||
../start -m $mssql_host -s $secretless_host |
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,3 @@ | ||
#!/bin/bash -ex | ||
|
||
../stop |
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,12 @@ | ||
#!/bin/bash -e | ||
|
||
# Automatically detect if we're devmode based on the existence | ||
# of the secretless-dev container. We assume that you started | ||
# your workflow using `./dev` if you are developing, and this | ||
# command will use the secretless-dev container. | ||
secretless_host="secretless-2017-CU1" | ||
if [[ ! -z $(docker-compose ps -q secretless-2017-CU1-dev) ]]; then | ||
secretless_host=secretless-2017-CU1-dev | ||
fi | ||
|
||
../test -s $secretless_host |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this is for local testing | ||
|
||
export TEST_ROOT="/secretless/test/connector/tcp/mssql" | ||
export DB_PROTOCOL="mssql" | ||
export DB_HOST_TLS="mssql-2017-CU1" | ||
export DB_HOST_NO_TLS="mssql-2017-CU1" | ||
export DB_PORT="1434" | ||
export DB_USER="sa" | ||
export DB_PASSWORD="yourStrong()Password" | ||
export SECRETLESS_HOST="127.0.0.1" | ||
export SECRETLESS_PORT="2224" | ||
|
||
cd .. | ||
go test -v |
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,3 @@ | ||
#!/bin/bash -ex | ||
|
||
../wait_for_mssql -m mssql-2017-CU1 |
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,3 @@ | ||
#!/bin/bash -ex | ||
|
||
./start -d |
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,48 @@ | ||
version: '3.0' | ||
|
||
services: | ||
|
||
mssql-2019: | ||
image: mcr.microsoft.com/mssql/server:2019-latest | ||
ports: | ||
- 1435:1433 | ||
environment: | ||
# This hardcoded password must match the one in secretless.yml. | ||
SA_PASSWORD: "yourStrong()Password" | ||
ACCEPT_EULA: Y | ||
|
||
secretless-2019: | ||
image: secretless-broker | ||
ports: | ||
- 2225:2223 | ||
volumes: | ||
- ./secretless.yml:/secretless.yml | ||
depends_on: | ||
- mssql-2019 | ||
|
||
secretless-2019-dev: | ||
image: secretless-dev | ||
command: ./bin/reflex | ||
ports: | ||
- 2225:2223 | ||
volumes: | ||
- ../../../../..:/secretless | ||
- ./secretless.yml:/secretless.yml | ||
depends_on: | ||
- mssql-2019 | ||
|
||
test: | ||
build: | ||
context: .. | ||
command: sleep 999d | ||
environment: | ||
TEST_ROOT: /secretless/test/connector/tcp/mssql | ||
DB_PROTOCOL: mssql | ||
DB_HOST_TLS: mssql-2019 | ||
DB_HOST_NO_TLS: mssql-2019 # TODO: configure a non-ssl container? | ||
DB_PORT: 1433 | ||
DB_USER: sa | ||
DB_PASSWORD: yourStrong()Password | ||
SECRETLESS_HOST: | ||
volumes: | ||
- ../../../../..:/secretless |
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,12 @@ | ||
version: 2 | ||
|
||
services: | ||
mssql: | ||
connector: mssql | ||
listenOn: tcp://0.0.0.0:2223 | ||
credentials: | ||
username: sa | ||
# This hardcoded password must match the one in the docker-compose. | ||
password: yourStrong()Password | ||
host: mssql-2019 | ||
port: 1433 |
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,12 @@ | ||
#!/bin/bash -ex | ||
|
||
mssql_host="mssql-2019" | ||
secretless_host="secretless-2019" | ||
while getopts ":d" opt; do | ||
case $opt in | ||
d) secretless_host=secretless-2019-dev;; | ||
*) echo "Unknown option -$OPTARG"; exit 1;; | ||
esac | ||
done | ||
|
||
../start -m $mssql_host -s $secretless_host |
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,3 @@ | ||
#!/bin/bash -ex | ||
|
||
../stop |
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,12 @@ | ||
#!/bin/bash -e | ||
|
||
# Automatically detect if we're devmode based on the existence | ||
# of the secretless-dev container. We assume that you started | ||
# your workflow using `./dev` if you are developing, and this | ||
# command will use the secretless-dev container. | ||
secretless_host="secretless-2019" | ||
if [[ ! -z $(docker-compose ps -q secretless-2019-dev) ]]; then | ||
secretless_host=secretless-2019-dev | ||
fi | ||
|
||
../test -s $secretless_host |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this is for local testing | ||
|
||
export TEST_ROOT="/secretless/test/connector/tcp/mssql" | ||
export DB_PROTOCOL="mssql" | ||
export DB_HOST_TLS="mssql-2019" | ||
export DB_HOST_NO_TLS="mssql-2019" | ||
export DB_PORT="1435" | ||
export DB_USER="sa" | ||
export DB_PASSWORD="yourStrong()Password" | ||
export SECRETLESS_HOST="127.0.0.1" | ||
export SECRETLESS_PORT="2225" | ||
|
||
cd .. | ||
go test -v |
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,3 @@ | ||
#!/bin/bash -ex | ||
|
||
../wait_for_mssql -m mssql-2019 |
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 |
---|---|---|
@@ -1,21 +1,33 @@ | ||
#!/bin/bash -ex | ||
|
||
SECRETLESS_HOST=secretless | ||
while getopts :d opt; do | ||
mssql_host=mssql | ||
while getopts :dm:s: opt; do | ||
case $opt in | ||
d) SECRETLESS_HOST=secretless-dev;; | ||
d) dev_mode=true;; | ||
m) mssql_host=${OPTARG};; | ||
s) secretless_host=${OPTARG};; | ||
\?) echo "Unknown option -$OPTARG"; exit 1;; | ||
esac | ||
done | ||
# If the secretless host is not explicitly set on the command line, | ||
# then use one of the default names (either secretless or | ||
# secretless-dev, depending on whether testing is being done in | ||
# development mode) for the secretless host. | ||
if [[ -z $secretless_host ]]; then | ||
secretless_host=secretless | ||
if [[ "$dev_mode" = true ]]; then | ||
secretless_host=secretless-dev | ||
fi | ||
fi | ||
|
||
./stop | ||
|
||
docker-compose build | ||
|
||
# the order of the services is important. mssql must be up before we start secretless | ||
docker-compose up -d mssql | ||
docker-compose up -d $secretless_host | ||
|
||
time ./wait_for_mssql | ||
docker-compose logs mssql | ||
time ./wait_for_mssql -m $mssql_host | ||
docker-compose logs $mssql_host | ||
|
||
docker-compose up -d $SECRETLESS_HOST | ||
docker-compose up -d $secretless_host |
Oops, something went wrong.