Skip to content

Commit 66e9a87

Browse files
Fix SqlCmd issues in the test
1 parent 6f5e473 commit 66e9a87

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"extensions": [
1313
"caarlos0.language-prometheus",
1414
"databricks.databricks",
15+
"github.vscode-github-actions",
1516
"hashicorp.terraform",
1617
"hediet.vscode-drawio",
1718
"jeppeandersen.vscode-kafka",

src/db/init-db.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/env bash
22

3+
SQLCMD="/opt/mssql-tools18/bin/sqlcmd"
4+
35
#do this in a loop because the timing for when the SQL instance is ready is indeterminate
46
for i in {1..60};
57
do
6-
/opt/mssql-tools/bin/sqlcmd -S "$MSSQL_HOST" -U "$MSSQL_SA_USER" -P "$MSSQL_SA_PASSWORD"
8+
$SQLCMD -C -S "$MSSQL_HOST" -U "$MSSQL_SA_USER" -P "$MSSQL_SA_PASSWORD"
79

810
if [ $? -eq 0 ]
911
then
@@ -15,5 +17,5 @@ do
1517
fi
1618
done
1719

18-
/opt/mssql-tools/bin/sqlcmd -S "$MSSQL_HOST" -U "$MSSQL_SA_USER" -P "$MSSQL_SA_PASSWORD" -i create_db.sql -v DBName="$DB_NAME"
19-
/opt/mssql-tools/bin/sqlcmd -S "$MSSQL_HOST" -U "$MSSQL_SA_USER" -P "$MSSQL_SA_PASSWORD" -d "$DB_NAME" -i create_table.sql
20+
$SQLCMD -C -S "$MSSQL_HOST" -U "$MSSQL_SA_USER" -P "$MSSQL_SA_PASSWORD" -i create_db.sql -v DBName="$DB_NAME"
21+
$SQLCMD -C -S "$MSSQL_HOST" -U "$MSSQL_SA_USER" -P "$MSSQL_SA_PASSWORD" -d "$DB_NAME" -i create_table.sql

src/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: "3.8"
21
services:
32
zookeeper:
43
image: confluentinc/cp-zookeeper

src/smoke-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ do
1616
# "-h -1" SQLCMD flag is used to remove column headers from the output
1717
# "SET NOCOUNT ON;" before the intended SQL query is used to remove output such as "n row(s) affected"
1818
# xargs removes the leading and trailing spaces from the output
19-
SQL_CMD="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P \"$MSSQL_SA_PASSWORD\" -d \"$DB_NAME\" -h -1 -Q \
19+
SQL_CMD="/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P \"$MSSQL_SA_PASSWORD\" -d \"$DB_NAME\" -h -1 -Q \
2020
\"SET NOCOUNT ON; SELECT COUNT(1) FROM $TABLE_NAME\" | xargs"
2121

2222
ROW_COUNT=$(docker compose exec sql-server bash -c "$SQL_CMD" || true)

0 commit comments

Comments
 (0)