File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,10 @@ Describe $CommandName -Tag IntegrationTests {
4747 Set-Content - Path $sqlFile - Value " xp_cmdshell 'powershell -command "" sleep 5"" '"
4848
4949 # Run sql file to start external process
50- Start-Process - FilePath sqlcmd - ArgumentList " -S $ ( $TestConfig.InstanceRestart ) -i $sqlFile " - NoNewWindow - RedirectStandardOutput null
50+ # -RedirectStandardOutput takes a file name, so "null" wrote a file called null into whatever
51+ # the current directory happened to be. The output goes next to the sql file instead.
52+ $sqlcmdOutputFile = " $ ( $TestConfig.Temp ) \sleep.out"
53+ Start-Process - FilePath sqlcmd - ArgumentList " -S $ ( $TestConfig.InstanceRestart ) -i $sqlFile " - NoNewWindow - RedirectStandardOutput $sqlcmdOutputFile
5154
5255 # We want to run all commands outside of the BeforeAll block without EnableException to be able to test for specific warnings.
5356 $PSDefaultParameterValues.Remove (" *-Dba*:EnableException" )
@@ -70,7 +73,7 @@ Describe $CommandName -Tag IntegrationTests {
7073
7174 # Restart the SQL Service to ensure we can remove the temporary file.
7275 $null = Restart-DbaService - ComputerName $TestConfig.InstanceRestart - Type Engine - Force
73- Remove-Item - Path $sqlFile
76+ Remove-Item - Path $sqlFile , $sqlcmdOutputFile
7477
7578 $PSDefaultParameterValues.Remove (" *-Dba*:EnableException" )
7679 }
Original file line number Diff line number Diff line change @@ -48,7 +48,10 @@ Describe $CommandName -Tag IntegrationTests {
4848 Set-Content - Path $sqlFile - Value " xp_cmdshell 'powershell -command "" sleep 5"" '"
4949
5050 # Run sql file to start external process
51- Start-Process - FilePath sqlcmd - ArgumentList " -S $ ( $TestConfig.InstanceRestart ) -i $sqlFile " - NoNewWindow - RedirectStandardOutput null
51+ # -RedirectStandardOutput takes a file name, so "null" wrote a file called null into whatever
52+ # the current directory happened to be. The output goes next to the sql file instead.
53+ $sqlcmdOutputFile = " $ ( $TestConfig.Temp ) \sleep.out"
54+ Start-Process - FilePath sqlcmd - ArgumentList " -S $ ( $TestConfig.InstanceRestart ) -i $sqlFile " - NoNewWindow - RedirectStandardOutput $sqlcmdOutputFile
5255
5356 # We want to run all commands outside of the BeforeAll block without EnableException to be able to test for specific warnings.
5457 $PSDefaultParameterValues.Remove (" *-Dba*:EnableException" )
@@ -71,7 +74,7 @@ Describe $CommandName -Tag IntegrationTests {
7174
7275 # Restart the SQL Service to ensure we can remove the temporary file.
7376 $null = Restart-DbaService - ComputerName $TestConfig.InstanceRestart - Type Engine - Force
74- Remove-Item - Path $sqlFile
77+ Remove-Item - Path $sqlFile , $sqlcmdOutputFile
7578
7679 $PSDefaultParameterValues.Remove (" *-Dba*:EnableException" )
7780 }
You can’t perform that action at this time.
0 commit comments