Skip to content

Commit

Permalink
Merge pull request #180 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 4.3.0.0 of StorageDsc
  • Loading branch information
kwirkykat authored Nov 28, 2018
2 parents fa73cc6 + 1b550d1 commit 689f7c1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 4.3.0.0

- WaitForDisk:
- Added readonly-property isAvailable which shows the current state
of the disk as a boolean - fixes [Issue #158](https://github.com/PowerShell/StorageDsc/issues/158).

## 4.2.0.0

- Disk:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function Get-TargetResource
$RetryCount = 60
)

$isAvailable = Test-TargetResource @PSBoundParameters

Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($localizedData.GettingWaitForDiskStatusMessage -f $DiskIdType,$DiskId)
Expand All @@ -70,6 +72,7 @@ function Get-TargetResource
DiskIdType = $DiskIdType
RetryIntervalSec = $RetryIntervalSec
RetryCount = $RetryCount
IsAvailable = $isAvailable
}
return $returnValue
} # function Get-TargetResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ class MSFT_WaitForDisk : OMI_BaseResource
[Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId","Guid"}, Values{"Number","UniqueId","Guid"}] String DiskIdType;
[Write, Description("Specifies the number of seconds to wait for the disk to become available.")] Uint32 RetryIntervalSec;
[Write, Description("The number of times to loop the retry interval while waiting for the disk.")] Uint32 RetryCount;
[Read, Description("Will indicate whether Disk is available.")] Boolean IsAvailable;
};
20 changes: 5 additions & 15 deletions Modules/StorageDsc/StorageDsc.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# RootModule = ''

# Version number of this module.
moduleVersion = '4.2.0.0'
moduleVersion = '4.3.0.0'

# ID used to uniquely identify this module
GUID = '00d73ca1-58b5-46b7-ac1a-5bfcf5814faf'
Expand Down Expand Up @@ -102,20 +102,9 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '- Disk:
- Added `PartitionStyle` parameter - Fixes [Issue 137](https://github.com/PowerShell/StorageDsc/issues/37).
- Changed MOF name from `MSFT_Disk` to `MSFTDSC_Disk` to remove conflict
with Windows built-in CIM class - Fixes [Issue 167](https://github.com/PowerShell/StorageDsc/issues/167).
- Opt-in to Common Tests:
- Common Tests - Validate Example Files To Be Published
- Common Tests - Validate Markdown Links
- Common Tests - Relative Path Length
- Added .VSCode settings for applying DSC PSSA rules - fixes [Issue 168](https://github.com/PowerShell/StorageDsc/issues/168).
- Disk:
- Added "defragsvc" service conflict known issue to README.MD - fixes
[Issue 172](https://github.com/PowerShell/StorageDsc/issues/172).
- Corrected style violations in StorageDsc.Common module - fixes [Issue 153](https://github.com/PowerShell/StorageDsc/issues/153).
- Corrected style violations in StorageDsc.ResourceHelper module.
ReleaseNotes = '- WaitForDisk:
- Added readonly-property isAvailable which shows the current state
of the disk as a boolean - fixes [Issue 158](https://github.com/PowerShell/StorageDsc/issues/158).
'

Expand All @@ -142,3 +131,4 @@ PrivateData = @{




3 changes: 3 additions & 0 deletions Tests/Integration/MSFT_WaitForDisk.Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ try
$current.DiskId | Should -Be $Disk.Number
$current.RetryIntervalSec | Should -Be 1
$current.RetryCount | Should -Be 5
$current.IsAvailable | Should -Be $true
}
}

Expand Down Expand Up @@ -107,6 +108,7 @@ try
$current.DiskId | Should -Be $Disk.UniqueId
$current.RetryIntervalSec | Should -Be 1
$current.RetryCount | Should -Be 5
$current.IsAvailable | Should -Be $true
}
}

Expand Down Expand Up @@ -147,6 +149,7 @@ try
$current.DiskId | Should -Be $Disk.Guid
$current.RetryIntervalSec | Should -Be 1
$current.RetryCount | Should -Be 5
$current.IsAvailable | Should -Be $true
}
}
}
Expand Down
33 changes: 33 additions & 0 deletions Tests/Unit/MSFT_WaitForDisk.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ try

#region Function Get-TargetResource
Describe "MSFT_WaitForDisk\Get-TargetResource" {

Mock `
-CommandName Test-TargetResource `
-MockWith { return $true } `
-Verifiable

Context 'Disk is specified by Number' {
$script:result = $null

Expand All @@ -87,6 +93,15 @@ try
It "Should return a RetryIntervalSec of $($disk0ParametersByNumber.RetryCount)" {
$script:result.RetryCount | Should -Be $disk0ParametersByNumber.RetryCount
}

It "Should return a IsAvailable of true" {
$script:result.IsAvailable | Should -Be $true
}

It 'Should call the correct mocks' {
Assert-VerifiableMock
Assert-MockCalled -CommandName Test-TargetResource -Exactly -Times 1
}
}

Context 'Disk is specified by Unique Id' {
Expand All @@ -113,6 +128,15 @@ try
It "Should return a RetryIntervalSec of $($disk0ParametersByUniqueId.RetryCount)" {
$script:result.RetryCount | Should -Be $disk0ParametersByUniqueId.RetryCount
}

It "Should return a IsAvailable of true" {
$script:result.IsAvailable | Should -Be $true
}

It 'Should call the correct mocks' {
Assert-VerifiableMock
Assert-MockCalled -CommandName Test-TargetResource -Exactly -Times 1
}
}

Context 'Disk is specified by Guid' {
Expand All @@ -139,6 +163,15 @@ try
It "Should return a RetryIntervalSec of $($disk0ParametersByGptGuid.RetryCount)" {
$script:result.RetryCount | Should -Be $disk0ParametersByGptGuid.RetryCount
}

It "Should return a IsAvailable of true" {
$script:result.IsAvailable | Should -Be $true
}

It 'Should call the correct mocks' {
Assert-VerifiableMock
Assert-MockCalled -CommandName Test-TargetResource -Exactly -Times 1
}
}
}
#endregion
Expand Down

0 comments on commit 689f7c1

Please sign in to comment.