From ed595220567b185b38790df3cd4cdbed2ee36619 Mon Sep 17 00:00:00 2001 From: George Fleming Date: Wed, 6 Jan 2016 10:14:17 -0800 Subject: [PATCH] Add new pester test to clean up created file --- .../test/Start-DscConfiguration.Tests.ps1 | 8 ++++++++ .../test/sample-cleanup.mof | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof diff --git a/src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 b/src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 index 4ac1b56b75..4168d5b889 100644 --- a/src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 +++ b/src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 @@ -3,6 +3,7 @@ $here = Split-Path -Parent $MyInvocation.MyCommand.Path $mof = "$here/assets/sample.mof" +$mofCleanup = "$here/assets/sample-cleanup.mof" $mofMeta = "$here/assets/sampleMeta.mof" $file = "/tmp/linux.txt" @@ -21,6 +22,13 @@ Describe "DscConfiguration" { $s.VALUE | Should Be "0" } + It "Should remove temp file just created" { + $s = Start-DscConfiguration -ConfigurationMof $mofCleanup | + Where-Object {$_.NAME -eq "ReturnValue"} + $s.VALUE | Should Be "0" + $file | Should Not Exist + } + It "Should set Meta MOF file properly" { $s = Set-DscLocalConfigurationManager -ConfigurationMof $mofMeta | Where-Object {$_.NAME -eq "ReturnValue"} diff --git a/src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof b/src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof new file mode 100644 index 0000000000..c1202308e6 --- /dev/null +++ b/src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof @@ -0,0 +1,19 @@ +instance of MSFT_nxFileResource +{ + Contents = "my contents"; + DestinationPath = "/tmp/linux.txt"; + Ensure = "Absent"; + Type = "File"; + ResourceId = "[MSFT_nxFileResource]File1"; + ModuleName = "nx"; + ModuleVersion = "1.0"; + + +}; + +instance of OMI_ConfigurationDocument +{ + Version="1.0.0"; + +}; +