Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dbatools Koans #140

Merged
merged 135 commits into from
May 19, 2020
Merged
Changes from 1 commit
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
ffcd62c
Basic scaffolding.
shaneis Dec 6, 2018
4b29f41
Added initial dbadatabase koan
shaneis Feb 17, 2019
9a5778e
Merge pull request #1 from vexx32/dbatools
shaneis Feb 18, 2019
c3ba20f
Fixed typo in the description block
shaneis Feb 26, 2019
8098297
Added extra description to first Get-DbaDatabase.ps1` Koan
shaneis Feb 26, 2019
de3e85a
Created Mocks folder in dbatools
shaneis Feb 26, 2019
e1e328c
changed mocks to call the xml database object
shaneis Feb 26, 2019
f98d5b2
Proper grammer is important
shaneis Feb 26, 2019
03d1424
Added test for passed in testdb name
shaneis Feb 26, 2019
4d07749
Move verbose messages
shaneis Feb 26, 2019
f0b5342
Changed details to not have localhost
shaneis Mar 2, 2019
f4cad79
Added Koan for using Get-DbaDatabase for all databases.
shaneis Mar 3, 2019
74fe873
Made testdb information consistent and fixed check on number of datab…
shaneis Mar 3, 2019
9534a2b
Added xml file for system databases.
shaneis Mar 3, 2019
f44aabc
Added koan for parameter: -ExcludeUser.
shaneis Mar 3, 2019
480742c
Added koan for the parameter: -ExcludeSystem.
shaneis Mar 3, 2019
7120462
Added example of using parameter: -ExcludeDatbase.
shaneis Mar 3, 2019
7b0ee91
Added koan of using parameter: -RecoveryModel.
shaneis Mar 3, 2019
92501f5
Basic scaffolding.
shaneis Dec 6, 2018
4a67dd2
Added initial dbadatabase koan
shaneis Feb 17, 2019
71feefc
Fixed typo in the description block
shaneis Feb 26, 2019
689924d
Added extra description to first Get-DbaDatabase.ps1` Koan
shaneis Feb 26, 2019
06ce0b2
Created Mocks folder in dbatools
shaneis Feb 26, 2019
db284b9
changed mocks to call the xml database object
shaneis Feb 26, 2019
e59af3a
Proper grammer is important
shaneis Feb 26, 2019
0d54074
Added test for passed in testdb name
shaneis Feb 26, 2019
b49588b
Move verbose messages
shaneis Feb 26, 2019
9cafaf6
Changed details to not have localhost
shaneis Mar 2, 2019
0bb505a
Fixed merge conficts.
shaneis Mar 5, 2019
48d9546
Removed evidence of my merge conflict resolution.
shaneis Mar 5, 2019
e298116
Pascal cased!
shaneis Mar 6, 2019
6fb5e46
If it is not necessary, why speak it?
shaneis Mar 6, 2019
af1e872
Do not repeat if it does not teach.
shaneis Mar 6, 2019
e0d4e1b
Bye bye extra by.
shaneis Mar 6, 2019
20be87a
Merging the commits made the sentences not make sense.
shaneis Mar 6, 2019
a0e7d18
Let's simplify the pipes.
shaneis Mar 6, 2019
59a2aed
Splatting through the KOAN.
shaneis Mar 7, 2019
e76749b
Added file.
shaneis Mar 10, 2019
1365dea
Added start description.
shaneis Mar 10, 2019
593ec62
First look at querying databases.
shaneis Mar 10, 2019
42645f6
Changed query to return meaningful data.
shaneis Mar 14, 2019
dc4b561
Added mock file for querying multiple servers.
shaneis Mar 18, 2019
96a11d9
Added koan for querying multiple servers.
shaneis Mar 18, 2019
ada3681
Added warning on not messing with Mocks.
shaneis Apr 2, 2019
1c897bd
Added warning on not messing with Mocks to AboutDbaDatabase.ps1
shaneis Apr 2, 2019
a6901dc
Removed unneeded parantheses surrounding variables.
shaneis Apr 2, 2019
58b9fe6
Removed backticks.
shaneis Apr 2, 2019
dd18ba0
Added explanation for @@SERVERNAME.
shaneis Apr 2, 2019
349ba75
Added newline to EOF for Unix.
shaneis Apr 2, 2019
838e266
Added next description for using -File parameter of Invoke-DbaQuery.
shaneis Apr 2, 2019
bc3a7cc
Invoke-DbaQuery with a file.
shaneis Apr 15, 2019
e81e399
Boiler plate added for using -SqlParameters parameter.
shaneis Apr 23, 2019
8544581
Changing 4 ___ 2 2 __.
shaneis Apr 27, 2019
7b43374
Changed query to be ready for Lil Bobby.
shaneis May 1, 2019
98c926a
Mocks! Mocks need to be updated too!
shaneis May 1, 2019
d4ab406
Wrapped string blanks in quotes.
shaneis May 1, 2019
e8a9731
Specified switch parameter.
shaneis May 15, 2019
5797d86
Cleared up grammer.
shaneis May 17, 2019
474dd52
Added comments for Lil Bobby Tables.
shaneis May 21, 2019
97936b6
Querying the Student table.
shaneis May 23, 2019
7607299
added mock and fixed typo bug on parameterfilters.
shaneis May 23, 2019
b5f592f
Mock file for StudentTable.
shaneis May 23, 2019
f850d98
[Bug fix]: Using $SqlParamResult01 instead of 02.
shaneis May 27, 2019
af39ccd
Added StudentTableParams.xml file for mocks.
shaneis May 27, 2019
5b18b84
Added example 2 of safe way of adding Bobby Tables.
shaneis Jun 14, 2019
b51ad43
Mock file for example 2 Bobby Tables.
shaneis Jun 14, 2019
0b5721c
Added mock for running example 2 bobby tables.
shaneis Jun 14, 2019
9e2cbf8
You know, some of these need a database parameter... :|
shaneis Jun 14, 2019
bd20eaa
*sigh* Can't even spell Bobby Tables name...
shaneis Jun 14, 2019
547e406
Added mock for SQL Injection.
shaneis Jul 1, 2019
bc2acb1
Splat for unsafe insert
shaneis Jul 22, 2019
d3d3096
Bobby tables test added
shaneis Jul 22, 2019
e5519ae
added needed -EnableException switch
shaneis Jul 22, 2019
2e5e334
Added comments about Bobby
shaneis Jul 22, 2019
10f6827
Started Backup-DbaDatabase
shaneis Jul 25, 2019
fc67fd9
Bumped koan position up, we'll do new-dbadatabase first
shaneis Jul 31, 2019
b8be891
Set up New-DbaDatabase koan
shaneis Jul 31, 2019
908bf87
Added Mock for basic New-DbaDatabase command
shaneis Aug 6, 2019
a468b2c
First example : default database
shaneis Aug 12, 2019
dfb33e1
Added Koan for New-DbaDatabase with Name parameter
shaneis Sep 3, 2019
2ff7612
Added mock for New-DbaDatabase with Name parameter
shaneis Sep 3, 2019
018d9bd
Koan for new database on multiple servers
shaneis Sep 5, 2019
fff2618
Created mock for new database on multiple servers
shaneis Sep 5, 2019
6c4237e
Added comment on placing data and log files
shaneis Oct 3, 2019
9aef750
Added mock for New-DbaDatabases and data / file paths
shaneis Oct 3, 2019
fe26517
Added koan for New-DbaDatabase and log / data file path
shaneis Oct 3, 2019
7cff6e2
Added comment on -Recoverymodel parameter
Oct 11, 2019
5b325e1
Added Mock for New-DbaDatabase with Full recovery model
Oct 16, 2019
86221fc
Added koan for New-DbaDatabase and -RecoveryModel
Oct 16, 2019
a83ca23
Added opening comments to AboutBackupDatabases.ps1
Nov 4, 2019
40bea25
Added default mock for Backup-DbaDatabase
Nov 11, 2019
4e19c1d
Added initial koan to backup all databases
Nov 11, 2019
afe16bc
Added comment for specific database backup Koan
Nov 12, 2019
4dfb6be
Added mock for specific database backup Koan. BUG FIX: fixed TotalSiz…
Nov 12, 2019
1a34b3e
Added koan for creating a backup of specific databases.
Nov 27, 2019
e1f7f2f
Added koan for types of backups.
shaneis Dec 3, 2019
195a417
Added koan for specific types of backups.
Dec 13, 2019
4295f15
Fixed merge conflict on pull
Jan 20, 2020
fe2ce80
Added comment for the -Path parameter
Jan 20, 2020
1bd07bd
Added mock about diff backups
Feb 6, 2020
ac8f5a4
Added backing up a database to a specific path.
shaneis Mar 15, 2020
885533f
Added mock for backing up a database to a specific path.
shaneis Mar 15, 2020
bf61b5a
Added using keywords for backup file names.
shaneis Mar 16, 2020
0d713a9
Bug fix: Fixed the typo on the variable name.
shaneis Mar 16, 2020
bc93bca
Added mock for using keywords.
shaneis Mar 16, 2020
58e13a5
Removed the '#Requires' line. Added a 'Module = 'dbatools') to the 'K…
Mar 18, 2020
cb93d88
New lines ftw!
Mar 18, 2020
07cf8ef
Added #region Mocks / #endregion around mocks.
Mar 18, 2020
1280427
Wrapped Mocks in a BeforeAll region.
Mar 18, 2020
63be11f
Added back the #Requires line.
shaneis Mar 21, 2020
981a5b7
Renamed files to 'Koans.ps1'.
shaneis Mar 21, 2020
ad03a95
Wrapped It block around backing up all SQL Server databases.
shaneis Mar 22, 2020
fa5fc49
Wrapped it block around specific database backups and types of backups.
shaneis Mar 22, 2020
3d3f004
Wrapped It block around connecting to SQL Server Instance.
Apr 7, 2020
79a7b56
Added It block around connecting to specific database name.
Apr 7, 2020
7b4fda4
Added It block around getting system databases.
Apr 7, 2020
a5e3ff3
Added It block around excluding system databases.
Apr 7, 2020
aac18be
Added It block around gathering databases based on their recovery model.
Apr 7, 2020
8270a24
Added It block around querying a default SQL Server instance.
Apr 7, 2020
ae5c37a
Added It block around querying multiple SQL Server instances.
Apr 7, 2020
fbadecb
Merge branch 'dbatools' of https://github.com/shaneis/PSKoans into db…
shaneis Apr 20, 2020
4018976
Wrapped It block around storing backups in specific locations.
shaneis Apr 20, 2020
c6d6f09
ACTUALLY wrapped It block around storing backups in specific locations.
shaneis Apr 20, 2020
a193e41
Wrapped It block around substituting keywords in file names.
shaneis Apr 20, 2020
68c1a73
Removed unnecessary brakets from Mocks.
shaneis Apr 20, 2020
c2c020b
Added a $ to the ExcludeUser param.
Apr 21, 2020
798681b
Wrapped It block around creating a new database.
Apr 21, 2020
2f5b3ae
Wrapped It block around creating new databases with specific names.
Apr 21, 2020
42d56bc
Wrapped It block around creating a database on multiple specified ins…
Apr 21, 2020
15299a7
Wrapped It block around creating a database with a specified recovery…
Apr 21, 2020
632bccd
Wrapped It block around creating a database with specified data and l…
Apr 21, 2020
2767e30
Extended the underscores from 2 to 4 on New-DbaDatabase -SqlInstance …
Apr 21, 2020
048a286
Wrapped It block around querying a database from a file.
Apr 21, 2020
57d4ebe
Wrapped It block around querying a database and passing values to par…
Apr 21, 2020
54d28fa
Wrapped It block around poor lil' Bobby Tables.
Apr 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added It block around querying multiple SQL Server instances.
  • Loading branch information
Shane O'Neill committed Apr 7, 2020
commit ae5c37a6e315b0496e34265e89e67d134afd3fec
18 changes: 10 additions & 8 deletions PSKoans/Koans/Modules/dbatools/AboutQueryingDatabases.ps1
Original file line number Diff line number Diff line change
@@ -55,14 +55,16 @@ Describe "Invoke-DbaQuery" {
$Bar.database_name | Should -Be 'master'
}

<#
Invoke-DbaQuery allows you to query a single database, multiple databases, or even multiple
servers.
The T-SQL command @@SERVERNAME returns the name of the server that the database is on. We can
use this to see what instance we are connected to.
#>
$ManyServers = 'localhost', 'localhost\SQLDEV2K14' | Invoke-DbaQuery -Query "SELECT @@SERVERNAME AS __;"
$ManyServers.server_name | Should -BeIn 'localhost', 'localhost\SQLDEV2K14'
It 'Queries multiple SQL Server instances...' {
<#
Invoke-DbaQuery allows you to query a single database, multiple databases, or even multiple
servers.
The T-SQL command @@SERVERNAME returns the name of the server that the database is on. We can
use this to see what instance we are connected to.
#>
$ManyServers = 'localhost', 'localhost\SQLDEV2K14' | Invoke-DbaQuery -Query "SELECT @@SERVERNAME AS __;"
$ManyServers.server_name | Should -BeIn 'localhost', 'localhost\SQLDEV2K14'
}

<#
It is possible to save T-SQL scripts into files. Invoke-DbaQuery has the ability to use the