Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Elton Stoneman <elton@sixeyed.com>
  • Loading branch information
sixeyed committed Feb 17, 2017
1 parent 8f62efc commit 9ac8738
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The filesystem path where the JSON manifests are stored.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $MountPath,

[Parameter(Mandatory = $true)]
[string] $ManifestPath
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The filesystem path where the JSON manifests are stored.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $MountPath,

[Parameter(Mandatory = $true)]
[string] $ManifestPath
)
Expand Down
3 changes: 3 additions & 0 deletions Functions/Private/Artifacts/Apache/Generate_Apache.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The filesystem path where the JSON manifests are stored.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $MountPath,

[Parameter(Mandatory = $true)]
[string] $ManifestPath
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The filesystem path where the JSON manifests are stored.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $MountPath,

[Parameter(Mandatory = $true)]
[string] $ManifestPath
)
Expand Down
3 changes: 3 additions & 0 deletions Functions/Private/Artifacts/DNSServer/Generate_DNSServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The filesystem path where the JSON manifests are stored.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $MountPath,

[Parameter(Mandatory = $true)]
[string] $ManifestPath
)
Expand Down
3 changes: 3 additions & 0 deletions Functions/Private/Artifacts/MSMQ/Generate_MSMQ.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The filesystem path where the JSON manifests are stored.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $MountPath,

[Parameter(Mandatory = $true)]
[string] $ManifestPath
)
Expand Down
3 changes: 3 additions & 0 deletions Functions/Private/Artifacts/SQLServer/Generate_SQLServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The filesystem path where the JSON manifests are stored.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $MountPath,

[Parameter(Mandatory = $true)]
[string] $ManifestPath
)
Expand Down
10 changes: 8 additions & 2 deletions Functions/Public/ConvertTo/ConvertTo-Dockerfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
This command is the main entrypoint into this PowerShell module.
.PARAMETER ImagePath
The filesystem path to the valid WIM or VHDX file that will be inspected for artifacts.
Use a Windows image file as the source for the artifacts. Specify the filesystem path to the valid WIM or VHDX file.
NOTE: You will need administrative permissions in order to mount and inspect image files.
.PARAMETER Local
Use the local machine as the source for the artifacts.
.PARAMETER RemotePath
Use a remote machine as the source for the artifacts. Specify the path to the system drive on the remote machine.
.PARAMETER OutputPath
An optional parameter that specifies the filesystem path where artifacts and the resulting
Dockerfile will be stored. If you do not specify a path, a temporary directory will be created for you within the $env:Temp location.
Expand Down Expand Up @@ -68,7 +74,7 @@
#>


[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars",'')]
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
Expand Down
10 changes: 5 additions & 5 deletions Functions/Public/ConvertTo/Tests/ConvertTo-Dockerfile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
It 'Has a Parameter called ImagePath' {
$Function.Parameters.Keys.Contains('ImagePath') | Should Be 'True'
}
It 'ImagePath Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.ImagePath.Attributes.Mandatory | Should be 'True'
It 'ImagePath Parameter is Identified as Mandatory being False' {
[String]$Function.Parameters.ImagePath.Attributes.Mandatory | Should be 'False'
}
It 'ImagePath Parameter is of String Type' {
$Function.Parameters.ImagePath.ParameterType.FullName | Should be 'System.String'
Expand Down Expand Up @@ -98,11 +98,11 @@
It 'Has a Parameter called Artifact' {
$Function.Parameters.Keys.Contains('Artifact') | Should Be 'True'
}
It 'Artifact Parameter is Identified as Mandatory being False' {
[String]$Function.Parameters.Artifact.Attributes.Mandatory | Should be 'False'
It 'Artifact Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.Artifact.Attributes.Mandatory | Should be 'True'
}
It 'Artifact Parameter is of String[] Type' {
$Function.Parameters.Artifact.ParameterType.FullName | Should be 'System.String[]'
$Function.Parameters.Artifact.ParameterType.FullName | Should be 'System.String'
}
It 'Artifact Parameter is member of ParameterSets' {
[String]$Function.Parameters.Artifact.ParameterSets.Keys | Should Be '__AllParameterSets'
Expand Down
2 changes: 1 addition & 1 deletion Image2Docker.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Image2Docker.psm1'

# Version number of this module.
ModuleVersion = '1.7.4'
ModuleVersion = '1.8.0'

# Supported PSEditions
### NOTE: This module will not work with PowerShell Core.
Expand Down
10 changes: 8 additions & 2 deletions Tests/Image2Docker.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,15 @@ Describe 'Current Tests' {
}
}
}
Context 'Test ConvertTo-Dockerfile command' {
Context 'Test ConvertTo-Dockerfile image path' {
It 'Should throw when -ImagePath parameter value is invalid' {
{ ConvertTo-Dockerfile -ImagePath c:\invalid\path.wim } | Should throw
{ ConvertTo-Dockerfile -ImagePath c:\invalid\path.wim -Artifact IIS } | Should throw
}
}

Context 'Test ConvertTo-Dockerfile source' {
It 'Should throw when none of -ImagePath, -RemotePath or -Local are passed' {
{ ConvertTo-Dockerfile -Artifact IIS } | Should throw
}
}

Expand Down

0 comments on commit 9ac8738

Please sign in to comment.