diff --git a/.github/workflows/code-coverage.yaml b/.github/workflows/code-coverage.yaml index 4052c09b..c9bb09af 100644 --- a/.github/workflows/code-coverage.yaml +++ b/.github/workflows/code-coverage.yaml @@ -215,7 +215,7 @@ jobs: "MSSQL": { "driver": "ODBC Driver 17 for SQL Server", "server": "localhost", - "database": "tempdb", + "database": "master", "UID": "SA", "PWD": "dbatools.I0" } @@ -226,21 +226,25 @@ jobs: uses: potatoqualitee/mssqlsuite@v1.7 with: install: sqlengine, sqlpackage, sqlclient + show-log: true - name: Setup testing schemata in SQL server if: ${{ inputs.schemas != 'none' }} run: | set -o xtrace + + sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -Q "ALTER LOGIN SA WITH DEFAULT_DATABASE = master;" + IFS=',' read -ra schemas <<< "${{ inputs.schemas }}" for schema in "${schemas[@]}"; do - sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "CREATE SCHEMA [$schema];" - sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "GO" + sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d master -Q "CREATE SCHEMA [$schema];" + sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d master -Q "GO" done - sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "SELECT * FROM sys.schemas" + sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d master -Q "SELECT * FROM sys.schemas" - sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA WHERE schema_name = 'test'" - sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d tempdb -Q "SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA WHERE schema_name = 'test.one'" + sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d master -Q "SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA WHERE schema_name = 'test'" + sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -d master -Q "SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA WHERE schema_name = 'test.one'" - uses: actions/checkout@v4 @@ -282,3 +286,17 @@ jobs: with: name: coverage-test-failures-mssql path: ${{ runner.temp }}/package + + - name: Collect docker logs + if: always() + uses: jwalton/gh-docker-logs@v1 + with: + dest: '${{ runner.workspace }}/logs-docker' + + - name: Check docker logs for SQL Server ERRORs + if: always() + run: | + ## -------------------------------------------------------------------- + log=$(find ${{ runner.workspace }}/logs-docker/ -name 'sql.log') + + cat "$log"