forked from ytgov/sfa-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/issue-16/dev-tooling--add-basic-…
…test-suite-setup-to-project' into marlen/dependency-bundle
- Loading branch information
Showing
12 changed files
with
12,941 additions
and
5,388 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,30 @@ | ||
#!/bin/bash | ||
|
||
# Wait 60 seconds for SQL Server to start up by ensuring that | ||
# calling SQLCMD does not return an error code, which will ensure that sqlcmd is accessible | ||
# and that system and user databases return "0" which means all databases are in an "online" state | ||
# https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-databases-transact-sql?view=sql-server-2017 | ||
|
||
DBSTATUS=1 | ||
ERRCODE=1 | ||
i=0 | ||
|
||
while [[ $DBSTATUS -ne 0 ]] && [[ $i -lt 60 ]] && [[ $ERRCODE -ne 0 ]]; do | ||
i=$i+1 | ||
DBSTATUS=$(/opt/mssql-tools/bin/sqlcmd -h -1 -t 1 -U sa -P "$MSSQL_SA_PASSWORD" -Q "SET NOCOUNT ON; Select SUM(state) from sys.databases") | ||
ERRCODE=$? | ||
sleep 1 | ||
done | ||
|
||
if [[ $DBSTATUS -ne 0 ]] || [[ $ERRCODE -ne 0 ]]; then | ||
echo "SQL Server took more than 60 seconds to start up or one or more databases are not in an ONLINE state" | ||
exit 1 | ||
fi | ||
|
||
# Run the setup script to create the DB and the schema in the DB | ||
/opt/mssql-tools/bin/sqlcmd \ | ||
-S localhost \ | ||
-U sa \ | ||
-P "$MSSQL_SA_PASSWORD" \ | ||
-d master \ | ||
-i ./initializers/setup.sql |
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,20 @@ | ||
FROM mcr.microsoft.com/mssql/server:2019-latest | ||
|
||
# current user:group => $whoami:$(id -gn) => mssql:root | ||
USER root | ||
RUN mkdir -p /usr/src/db && chown mssql:root /usr/src/db | ||
USER mssql | ||
|
||
WORKDIR /usr/src/db | ||
|
||
# Data | ||
# COPY ./db/data /var/opt/mssql/data | ||
# COPY ./db/log /var/opt/mssql/log | ||
# COPY ./db/backups /var/opt/mssql/data/backups | ||
|
||
# Intialization | ||
COPY --chown=mssql:root --chmod=+x ./db/entrypoint.sh ./ | ||
COPY --chown=mssql:root --chmod=+x ./db/bin ./bin | ||
COPY --chown=mssql:root ./db/initializers ./initializers | ||
|
||
ENTRYPOINT ["/usr/src/db/entrypoint.sh"] |
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,8 @@ | ||
#!/bin/bash | ||
|
||
# Start the script to create the DB and user | ||
cd /usr/src/db | ||
./bin/configure-db.sh & | ||
|
||
# Start SQL Server | ||
/opt/mssql/bin/sqlservr |
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,21 @@ | ||
/* | ||
Enter custom T-SQL here that would run after SQL Server has started up. | ||
*/ | ||
|
||
IF NOT EXISTS ( | ||
SELECT name | ||
FROM sys.databases | ||
WHERE name = N'SFADB_DEV' | ||
) | ||
CREATE DATABASE SFADB_DEV; | ||
GO | ||
|
||
IF NOT EXISTS ( | ||
SELECT name | ||
FROM sys.databases | ||
WHERE name = N'sfa_client_test' | ||
) | ||
CREATE DATABASE sfa_client_test; | ||
GO |
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,11 @@ | ||
import type { JestConfigWithTsJest } from "ts-jest" | ||
|
||
export const jestConfig: JestConfigWithTsJest = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
moduleNameMapper: { | ||
"^@/(.*)$": ["<rootDir>/$1"], | ||
}, | ||
} | ||
|
||
export default jestConfig |
Oops, something went wrong.