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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+9-15Lines changed: 9 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,24 +130,18 @@ You can inspect/copy/cannibalize existing tests. You'll see that every test file
130
130
131
131
## AppVeyor Environment
132
132
133
-
AppVeyor is hooked up to test any commit, including PRs. Each commit triggers 5 builds, each referred to as a "scenario". We have the scenarios setup where the dbatools log is published as an artifact should you need to view why test are failing.
133
+
AppVeyor is hooked up to test any commit, including PRs. Each commit triggers several builds, each referred to as a "scenario". We have the scenarios setup where the dbatools log is published as an artifact should you need to view why test are failing.
134
134
135
-
- 2008R2 : a server with a single SQL Server 2008 R2 Express Edition instance available ($script:instance1)
136
-
- 2016 : a server with a single SQL Server 2016 Developer Edition instance available ($script:instance2)
137
-
- 2016_service: used to test service restarts
138
-
- 2016_2017 : a server with two instances available, 2016 and 2017 Developer Edition
139
-
- default: a server with two instances available, one SQL Server 2008 R2 Express Edition and a SQL Server 2016 Developer Edition
135
+
- SINGLE: a server with a single SQL Server 2022 instance available ($TestConfig.InstanceSingle)
136
+
- MULTI: a server with two instances (SQL Server 2022 and SQL Server 2017) available for tests that need multiple instances ($TestConfig.InstanceMulti1 and $TestConfig.InstanceMulti2)
137
+
- COPY: a server with two instances (SQL Server 2017 and SQL Server 2022) available for tests that need multiple instances ($TestConfig.InstanceCopy1 and $TestConfig.InstanceCopy2)
138
+
- HADR: a single SQL Server 2022 instance available with Hadr configured ($TestConfig.InstanceHadr)
139
+
- RESTART: used to test service restarts ($TestConfig.InstanceRestart)
140
+
- 2008R2SP2Express: a server with a single SQL Server 2008 R2 Express Edition available to test some commands against an old version ($TestConfig.InstanceSingle)
141
+
- default: a server with no instance for all tests that don't need a running instance
140
142
141
143
Builds are split among "scenario"(s) because not every test requires everything to be up and running, and resources on AppVeyor are constrained.
142
-
143
-
Ideally:
144
-
145
-
1. Whenever possible, write UnitTests.
146
-
2. You should write IntegrationTests ideally running in **EITHER** the 2008R2 or the 2016 "scenario".
147
-
3. Default and 2016_2017 are the most resource constrained and are left to run the Copy-* commands which are the only ones **needing** two active instances.
148
-
4. If you want to write tests that, e.g, target **BOTH** 2008R2 and 2016, try to avoid writing tests that need both instances to be active at the same time.
149
-
150
-
AppVeyor is set up to recognize what "scenario" is required by your test, simply inspecting for the presence of combinations of `$script:instance1`, `$script:instance2` and `$script:instance3`. If you need to fall into case (4), write two test files, e.g. _Get-DbaFoo.first.Tests.ps1_ (targeting `$script:instance1` only) and _Get-DbaFoo.second.Tests.ps1_ (targeting `$script:instance2` only).
144
+
AppVeyor is set up to recognize what "scenario" is required by your test, simply inspecting for the presence of $TestConfig.Instance*.
151
145
152
146
Most PRs will target `public/*.ps1` files to add functionality or resolve bugs.
153
147
Our test runner will try and figure out what tests needs to be run based on the files modified in the PR, plus all the dependencies.
0 commit comments