Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion Tests/AllToolsUtilities.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# #
###########################################################################

using module ..\containers-toolkit\Private\Logger.psm1

Describe "AllToolsUtilities.psm1" {
BeforeAll {
Expand All @@ -17,6 +18,10 @@ Describe "AllToolsUtilities.psm1" {
Import-Module -Name "$ModuleParentPath\Public\NerdctlTools.psm1" -Force
Import-Module -Name "$ModuleParentPath\Public\ContainerNetworkTools.psm1" -Force
Import-Module -Name "$ModuleParentPath\Public\AllToolsUtilities.psm1" -Force

# Mock functions
Mock New-EventLog -ModuleName 'Logger'
Mock Write-EventLog -ModuleName 'Logger'
}

AfterAll {
Expand Down Expand Up @@ -268,4 +273,4 @@ Describe "AllToolsUtilities.psm1" {
$Error[0].Exception.Message | Should -Be 'Failed to initialize NAT network. Error message'
}
}
}
}
5 changes: 4 additions & 1 deletion Tests/BuildkitTools.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
###########################################################################

using module "..\containers-toolkit\Private\CommonToolUtilities.psm1"
using module ..\containers-toolkit\Private\Logger.psm1

Describe "BuildkitTools.psm1" {
BeforeAll {
Expand All @@ -28,6 +29,8 @@ Describe "BuildkitTools.psm1" {
# Mock functions
function Test-ServiceRegistered { }
Mock Test-ServiceRegistered -ModuleName 'BuildkitTools' -MockWith { return $true }
Mock New-EventLog -ModuleName 'Logger'
Mock Write-EventLog -ModuleName 'Logger'
}

AfterEach {
Expand Down Expand Up @@ -361,4 +364,4 @@ Describe "BuildkitTools.psm1" {
Should -Invoke Remove-FeatureFromPath -Times 0 -Scope It -ModuleName "BuildkitTools"
}
}
}
}
7 changes: 6 additions & 1 deletion Tests/CommonToolUtilities.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


using module "..\containers-toolkit\Private\CommonToolUtilities.psm1"
using module ..\containers-toolkit\Private\Logger.psm1

$Script:SampleSha256Sum = @'
6b8ff12339733a6SSaMpLeSHAe2ff9f8d333c9e898 nerdctl-2.0.0-linux-amd64.tar.gz
Expand Down Expand Up @@ -74,6 +75,10 @@ Describe "CommonToolUtilities.psm1" {

$ProgramFiles = "TestDrive:\Program Files"
New-Item -Path $ProgramFiles -ItemType Directory -Force | Out-Null

# Mock functions
Mock New-EventLog -ModuleName 'Logger'
Mock Write-EventLog -ModuleName 'Logger'
}

AfterAll {
Expand Down Expand Up @@ -838,4 +843,4 @@ Describe "CommonToolUtilities.psm1" {
$Error[0].Exception.Message | Should -BeExactly "Failed to delete directory: 'TestDrive\Buildkit'. Error"
}
}
}
}
7 changes: 6 additions & 1 deletion Tests/ContainerNetworkTools.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


using module "..\containers-toolkit\Private\CommonToolUtilities.psm1"
using module ..\containers-toolkit\Private\Logger.psm1

Describe "ContainerNetworkTools.psm1" {
BeforeAll {
Expand All @@ -17,6 +18,10 @@ Describe "ContainerNetworkTools.psm1" {
Import-Module -Name "$ModuleParentPath\Private\CommonToolUtilities.psm1" -Force
Import-Module -Name "$ModuleParentPath\Public\ContainerNetworkTools.psm1" -Force
Import-Module -Name "$RootPath\Tests\TestData\MockClasses.psm1" -Force

# Mock functions
Mock New-EventLog -ModuleName 'Logger'
Mock Write-EventLog -ModuleName 'Logger'
}

AfterEach {
Expand Down Expand Up @@ -295,4 +300,4 @@ Describe "ContainerNetworkTools.psm1" {
$Error[0].Exception.Message | Should -Be 'Windows CNI plugin does not exist at TestDrive:\TestDir\cni or the directory is empty.'
}
}
}
}
5 changes: 4 additions & 1 deletion Tests/ContainerdTools.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# #
###########################################################################

using module ..\containers-toolkit\Private\Logger.psm1

Describe "ContainerdTools.psm1" {
BeforeAll {
Expand All @@ -28,6 +29,8 @@ Describe "ContainerdTools.psm1" {
# Mock functions
function Test-ServiceRegistered { }
Mock Test-ServiceRegistered -ModuleName 'ContainerdTools' -MockWith { return $true }
Mock New-EventLog -ModuleName 'Logger'
Mock Write-EventLog -ModuleName 'Logger'
}

AfterEach {
Expand Down Expand Up @@ -338,4 +341,4 @@ Describe "ContainerdTools.psm1" {
Should -Invoke Remove-FeatureFromPath -Times 0 -Scope It -ModuleName "ContainerdTools"
}
}
}
}
5 changes: 5 additions & 0 deletions Tests/NerdctlTools.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


using module "..\containers-toolkit\Private\CommonToolUtilities.psm1"
using module ..\containers-toolkit\Private\Logger.psm1

Describe "NerdctlTools.psm1" {
BeforeAll {
Expand All @@ -18,6 +19,10 @@ Describe "NerdctlTools.psm1" {
Import-Module -Name "$ModuleParentPath\Public\ContainerdTools.psm1"
Import-Module -Name "$ModuleParentPath\Public\ContainerNetworkTools.psm1"
Import-Module -Name "$ModuleParentPath\Public\NerdctlTools.psm1" -Force

# Mock functions
Mock New-EventLog -ModuleName 'Logger'
Mock Write-EventLog -ModuleName 'Logger'
}

AfterEach {
Expand Down
5 changes: 5 additions & 0 deletions Tests/UpdateEnvironmentPath.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# #
###########################################################################

using module ..\containers-toolkit\Private\Logger.psm1

Describe "UpdateEnvironmentPath.psm1" {
BeforeAll {
Expand All @@ -16,6 +17,10 @@ Describe "UpdateEnvironmentPath.psm1" {
# Original enviromnent values
$Script:originalUserPathString = $ENV:Path
$Script:originalSysPathString = [System.Environment]::GetEnvironmentVariable("Path", "Machine")

# Mock functions
Mock New-EventLog -ModuleName 'Logger'
Mock Write-EventLog -ModuleName 'Logger'
}

AfterAll {
Expand Down