Skip to content

Commit

Permalink
Fix sqlserver linux regression: Migrate to sqlserver 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
javiertuya committed Sep 21, 2024
1 parent e79ab12 commit 7595d22
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:
-e TEST_SQLSERVER_PWD="$TEST_SQLSERVER_PWD" \
-e "ACCEPT_EULA=Y" -e "MSSQL_PID=Developer" \
-v ${GITHUB_WORKSPACE}/setup/sqlserver:/setup.d \
mcr.microsoft.com/mssql/server:2017-latest
mcr.microsoft.com/mssql/server:2019-latest
chmod u+x setup/wait-container-ready.sh && ./setup/wait-container-ready.sh test-sqlserver "SQL Server is now ready for client connections"
# SQLServer does not have an on startup script, run it now
docker exec test-sqlserver bash -c "chmod u+x setup.d/sqlserver-setup.sh && ./setup.d/sqlserver-setup.sh"
docker exec --user root test-sqlserver bash -c "chmod u+x setup.d/sqlserver-setup.sh && ./setup.d/sqlserver-setup.sh"
- name: Launch Oracle
if: ${{ matrix.scope == 'Oracle' }}
Expand Down Expand Up @@ -158,10 +158,10 @@ jobs:
-e TEST_SQLSERVER_PWD="$TEST_SQLSERVER_PWD" \
-e "ACCEPT_EULA=Y" -e "MSSQL_PID=Developer" \
-v ${GITHUB_WORKSPACE}/setup/sqlserver:/setup.d \
mcr.microsoft.com/mssql/server:2017-latest
mcr.microsoft.com/mssql/server:2019-latest
chmod u+x ../setup/wait-container-ready.sh && ../setup/wait-container-ready.sh test-sqlserver "SQL Server is now ready for client connections"
# SQLServer does not have an on startup script, run it now
docker exec test-sqlserver bash -c "chmod u+x setup.d/sqlserver-setup.sh && ./setup.d/sqlserver-setup.sh"
docker exec --user root test-sqlserver bash -c "chmod u+x setup.d/sqlserver-setup.sh && ./setup.d/sqlserver-setup.sh"
- name: Run test
run: dotnet test --logger "trx;LogFileName=../../reports/tdrules-report.trx" TdRulesTest/TdRulesTest.csproj
Expand Down
2 changes: 1 addition & 1 deletion setup/container-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ docker run -d -p 1433:1433 --name test-sqlserver --restart unless-stopped \
-e TEST_SQLSERVER_PWD="$TEST_SQLSERVER_PWD" \
-e "ACCEPT_EULA=Y" -e "MSSQL_PID=Developer" \
-v /${PWD}/sqlserver:/setup.d \
mcr.microsoft.com/mssql/server:2017-latest
mcr.microsoft.com/mssql/server:2019-latest
./wait-container-ready.sh test-sqlserver "SQL Server is now ready for client connections"
# SQLServer does not have an on startup script, run it now
docker exec test-sqlserver bash -c "./setup.d/sqlserver-setup.sh"
Expand Down
4 changes: 2 additions & 2 deletions setup/database.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tdrules.java.tdstorerdb2.sqlserver.user=tdstorerdb2
tdrules.java.tdloadrdb.sqlserver.url=jdbc:sqlserver://localhost:1433;databaseName=tdloadrdb;encrypt=true;trustServerCertificate=true
tdrules.java.tdloadrdb.sqlserver.user=tdloadrdb

tdrules.java.tdstorerdb2.sqlserver.meta.dbms=Database: Microsoft SQL Server - Version: 14.
tdrules.java.tdstorerdb2.sqlserver.meta.dbms=Database: Microsoft SQL Server - Version: 15.
tdrules.java.tdstorerdb2.sqlserver.meta.driver=Driver: Microsoft JDBC Driver 12.

# Oracle is not tested in the client-rdb (tdclirdb)
Expand Down Expand Up @@ -60,7 +60,7 @@ tdrules.netcore.tdclirdb.sqlserver.user=tdclirdb
tdrules.netcore.tdstorerdb2.sqlserver.url=Server=(local);Database=tdstorerdb2
tdrules.netcore.tdstorerdb2.sqlserver.user=tdstorerdb2

tdrules.netcore.tdstorerdb2.sqlserver.meta.dbms=Database: Microsoft SQL Server - Version: 14.
tdrules.netcore.tdstorerdb2.sqlserver.meta.dbms=Database: Microsoft SQL Server - Version: 15.
tdrules.netcore.tdstorerdb2.sqlserver.meta.driver=Driver: System.Data.SqlClient.SqlConnection - Version: N/A

# sqlite
Expand Down
4 changes: 2 additions & 2 deletions setup/sqlserver/sqlserver-setup.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Execution of sqlserver commands after startup
# A little bit flaky in GitHub, check first connection and wait if fails
echo "-- Try first connection"
if ! /opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U sa -P $TEST_SQLSERVER_PWD -l 30 -Q "select name from sys.databases"; then
if ! /opt/mssql-tools18/bin/sqlcmd -C -S localhost,1433 -U sa -P $TEST_SQLSERVER_PWD -l 30 -Q "select name from sys.databases"; then
echo "Failure to connect from sa, wait some time"
sleep 4
echo "End sleep, going to setup"
#this seems to solve login failure, but sometimes: Error: Process completed with exit code 137.
fi
echo "-- Begin setup"
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U sa -P $TEST_SQLSERVER_PWD -l 30 <<-EOSQL
/opt/mssql-tools18/bin/sqlcmd -C -S localhost,1433 -U sa -P $TEST_SQLSERVER_PWD -l 30 <<-EOSQL
CREATE LOGIN tdclirdb WITH PASSWORD = '$TEST_SQLSERVER_PWD', CHECK_POLICY=OFF, CHECK_EXPIRATION=OFF, DEFAULT_LANGUAGE=spanish;
GO
CREATE DATABASE tdclirdb
Expand Down

0 comments on commit 7595d22

Please sign in to comment.