You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -45,7 +45,7 @@ To run this example, the following basic concepts are required.
45
45
46
46
## Case history
47
47
48
-
The AdventureWorks2017 database contains the Production.Product table that stores products managed and sold by the fake company Adventure Works LTD.
48
+
The AdventureWorks database contains the Production.Product table that stores products managed and sold by the fake company Adventure Works LTD.
49
49
50
50
The trigger we have wrote is to prevent the insertion of new products with values less than 10 as a “safety stock”. The Company wishes to always have a warehouse stock of no less than 10 units for each product. The safety stock level is a very important value for the automatic procedures: it allows to re-order materials. The creation of new purchase orders and production orders are based on the safety stock level. To make our trigger simple, it will only respond to the OnInsert event, for INSERT commands.
51
51
@@ -58,9 +58,9 @@ The trigger we have wrote is to prevent the insertion of new products with value
58
58
1.[Sign in](https://github.com/login) to GitHub. If you don't already have an account, [sign up for a new GitHub account](https://docs.github.com/get-started/signing-up-for-github/signing-up-for-a-new-github-account)
59
59
2. Create your sample repository on GitHub, if you've never done it, you can find the guide [here](https://docs.github.com/get-started/quickstart/create-a-repo)
60
60
3. Create a `.github/workflows` directory in your GitHub repository if this directory does not already exist
61
-
4. Copy the automated-tests.yml inside the directory `.github/workflows` you created in the previous step. The `automated-tests.yml` describes the process that will execute one or more jobs
61
+
4. Copy the [automated-tests.yml](https://github.com/microsoft/sql-server-samples/tree/master/samples/containers/unit-testing/tsqlt-docker/.github/workflows) inside the directory `.github/workflows` you created in the previous step in your repository. The `automated-tests.yml` describes the process that will execute one or more jobs
62
62
5. Create the `source` and `unit-test` directories in the root of your sample repository
63
-
6. Copy all the files located in the source and unit-test directories to their respective directories in your repository
63
+
6. Copy all the files located in the [source](https://github.com/microsoft/sql-server-samples/tree/master/samples/containers/unit-testing/tsqlt-docker/source) and [unit-test](https://github.com/microsoft/sql-server-samples/tree/master/samples/containers/unit-testing/tsqlt-docker/unit-test) directories to their respective directories in your repository
64
64
7. View and run the workflow as described [here](https://docs.github.com/actions/quickstart)
65
65
8. Have fun with the solution details outlined below
66
66
@@ -78,7 +78,7 @@ A sample YAML file that implements the test automation workflow is already in yo
78
78
79
79
1. Definition of activation events
80
80
2. Creating a Docker container from a SQL Server image on Linux
81
-
3.AdventureWorks2017 database recovery
81
+
3.AdventureWorks database recovery
82
82
4. Installation of the tSQLt framework
83
83
5. Creating the database objects to be tested (SUT)
84
84
6. Creation and execution unit tests
@@ -136,20 +136,20 @@ The following snippet of YAML code sets the ENV_CONTAINER_ID variable with the I
The AdventureWorks2017 database recovery can be performed using the following docker exec command.
141
+
The AdventureWorks database recovery can be performed using the following docker exec command.
142
142
143
143
```
144
-
- name: Restore AdventureWorks2017
144
+
- name: Restore AdventureWorks
145
145
run: docker exec -i $ENV_CONTAINER_ID /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "3uuiCaKxfbForrK" -Q "RESTORE DATABASE [AdventureWorks2017] FROM DISK = '/adventureworks.bak' WITH MOVE 'AdventureWorks2017' TO '/var/opt/mssql/data/AdventureWorks.mdf', MOVE 'AdventureWorks2017_log' TO '/var/opt/mssql/data/AdventureWorks_log.ldf'"
146
146
```
147
147
148
148
**4. Installation of the tSQLt framework**
149
149
150
-
The installation of the latest version of tSQLt framework in the AdventureWorks2017 database is done using the GitHub Actions tSQLt Installer published by [lowlydba](https://github.com/lowlydba), you can find more details [here](https://github.com/lowlydba/tsqlt-installer) and on the [GitHub Actions marketplace](https://github.com/marketplace/actions/tsqlt-installer).
150
+
The installation of the latest version of tSQLt framework in the AdventureWorks database is done using the GitHub Actions tSQLt Installer published by [lowlydba](https://github.com/lowlydba), you can find more details [here](https://github.com/lowlydba/tsqlt-installer) and on the [GitHub Actions marketplace](https://github.com/marketplace/actions/tsqlt-installer).
151
151
152
-
The snippet of YAML code used for the installation of the tSQLt framework in the AdventureWorks2017 database is the following.
152
+
The snippet of YAML code used for the installation of the tSQLt framework in the AdventureWorks database is the following.
153
153
154
154
```
155
155
steps:
@@ -166,13 +166,13 @@ steps:
166
166
167
167
**5. Creating the database objects to be tested (SUT)**
168
168
169
-
The test environment is ready, we have a SQL Server instance on Linux inside a Docker container; the AdventureWorks2017 database has been restored and it is ready for use.
169
+
The test environment is ready, we have a SQL Server instance on Linux inside a Docker container; the AdventureWorks database has been restored and it is ready for use.
170
170
171
171
Let's go ahead with the creation of the trigger and the stored procedure (that manages errors), they represent our [System Under Test (SUT)](https://en.wikipedia.org/wiki/System_under_test).
172
172
173
173
The TR_Product_SafetyStockLevel trigger creation script and the usp_Raiserror_SafetyStockLevel stored procedure creation script are saved in the source directory of this sample.
174
174
175
-
Triggers and stored procedures are created in the AdventureWorks2017 database attached to the SQL Server instance, the YAML code snippet that performs this operation is the following.
175
+
Triggers and stored procedures are created in the AdventureWorks database attached to the SQL Server instance, the YAML code snippet that performs this operation is the following.
0 commit comments