Skip to content

Commit 9f72c10

Browse files
authored
Add links to resources used in the sample
Changed database name from AdventureWorks2017 to AdventureWorks in descriptions
1 parent b764ae7 commit 9f72c10

File tree

1 file changed

+13
-13
lines changed
  • samples/containers/unit-testing/tsqlt-docker

1 file changed

+13
-13
lines changed

samples/containers/unit-testing/tsqlt-docker/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ This sample describes how to automate the testing for one or more SQL Server obj
2121

2222
- **Applies to:** SQL Server 2016 (or higher)
2323
- **Key features:** Run SQL Server in Docker containers
24-
- **Workload:** Unit tests executed on [AdventureWorks2017](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks)
24+
- **Workload:** Unit tests executed on [AdventureWorks](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks)
2525
- **Programming Language:** T-SQL, YAML
26-
- **Authors:** [Sergio Govoni](https://www.linkedin.com/in/sgovoni/)
26+
- **Authors:** [Sergio Govoni](https://www.linkedin.com/in/sgovoni/) | [Microsoft MVP Profile](https://mvp.microsoft.com/it-it/PublicProfile/4029181?fullName=Sergio%20Govoni) | [Blog](https://segovoni.medium.com/) | [GitHub](https://github.com/segovoni) | [Twitter](https://twitter.com/segovoni)
2727

2828
<a name=before-you-begin></a>
2929

@@ -45,7 +45,7 @@ To run this example, the following basic concepts are required.
4545

4646
## Case history
4747

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.
4949

5050
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.
5151

@@ -58,9 +58,9 @@ The trigger we have wrote is to prevent the insertion of new products with value
5858
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)
5959
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)
6060
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
6262
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
6464
7. View and run the workflow as described [here](https://docs.github.com/actions/quickstart)
6565
8. Have fun with the solution details outlined below
6666

@@ -78,7 +78,7 @@ A sample YAML file that implements the test automation workflow is already in yo
7878

7979
1. Definition of activation events
8080
2. Creating a Docker container from a SQL Server image on Linux
81-
3. AdventureWorks2017 database recovery
81+
3. AdventureWorks database recovery
8282
4. Installation of the tSQLt framework
8383
5. Creating the database objects to be tested (SUT)
8484
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
136136
run: echo "ENV_CONTAINER_ID=$(docker ps --all --filter status=running --no-trunc --format "{{.ID}}")" >> $GITHUB_ENV
137137
```
138138

139-
**3. AdventureWorks2017 database recovery**
139+
**3. AdventureWorks database recovery**
140140

141-
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.
142142

143143
```
144-
- name: Restore AdventureWorks2017
144+
- name: Restore AdventureWorks
145145
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'"
146146
```
147147

148148
**4. Installation of the tSQLt framework**
149149

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).
151151

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.
153153

154154
```
155155
steps:
@@ -166,13 +166,13 @@ steps:
166166

167167
**5. Creating the database objects to be tested (SUT)**
168168

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.
170170

171171
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).
172172

173173
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.
174174

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.
176176

177177
```
178178
- name: Create sp usp_Raiserror_SafetyStockLevel

0 commit comments

Comments
 (0)