Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions parts/windows/windowscsehelper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ function Get-WindowsVersion {
"17763" { return "1809" }
"20348" { return "ltsc2022" }
"25398" { return "23H2" }
{$_ -ge "25399" -and $_ -le "30397"} { return "test2025" }
"26100" { return "test2025" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's update the returned version too - "test2025" => "2025"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the returned version from "test2025" to "2025" as requested. This change affects the Get-WindowsVersion function, containerd logic, all related tests, and regenerated test data files. Commit: 55311f6

Default {
Set-ExitCode -ExitCode $global:WINDOWS_CSE_ERROR_NOT_FOUND_BUILD_NUMBER -ErrorMessage "Failed to find the windows build number: $buildNumber"
}
Expand All @@ -392,7 +392,7 @@ function Get-WindowsPauseVersion {
"17763" { return "1809" }
"20348" { return "ltsc2022" }
"25398" { return "ltsc2022" }
{$_ -ge "25399" -and $_ -le "30397"} { return "ltsc2022" }
"26100" { return "ltsc2022" }
Default {
Set-ExitCode -ExitCode $global:WINDOWS_CSE_ERROR_NOT_FOUND_BUILD_NUMBER -ErrorMessage "Failed to find the windows build number: $buildNumber"
}
Expand Down
30 changes: 18 additions & 12 deletions parts/windows/windowscsehelper.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,21 @@ Describe 'Get-WindowsVersion and Get-WindowsPauseVersion' {
$windowsVersion | Should -Be $expectedVersion
}

It 'build number is from prerelease of windows 2025' {
Mock Get-WindowsBuildNumber -MockWith { return "25399" }
It 'build number is from Windows 2025' {
Mock Get-WindowsBuildNumber -MockWith { return "26100" }
$windowsVersion = Get-WindowsVersion
$expectedVersion = "test2025"
$windowsVersion | Should -Be $expectedVersion
}

It 'build number is from prerelease of windows 2025' {
It 'build number is from prerelease of windows 2025 (should now fail)' {
Mock Get-WindowsBuildNumber -MockWith { return "30397" }
$windowsVersion = Get-WindowsVersion
$expectedVersion = "test2025"
$windowsVersion | Should -Be $expectedVersion
try {
$windowsVersion = Get-WindowsVersion
} catch {
Write-Host "Expected exception: $_"
}
Assert-MockCalled -CommandName 'Set-ExitCode' -Exactly -Times 1 -ParameterFilter { $ExitCode -eq $global:WINDOWS_CSE_ERROR_NOT_FOUND_BUILD_NUMBER }
}

It 'build number is unknown' {
Expand All @@ -180,18 +183,21 @@ Describe 'Get-WindowsVersion and Get-WindowsPauseVersion' {
Assert-MockCalled -CommandName 'Set-ExitCode' -Exactly -Times 1 -ParameterFilter { $ExitCode -eq $global:WINDOWS_CSE_ERROR_NOT_FOUND_BUILD_NUMBER }
}

It 'build number is from prerelease of windows 2025' {
Mock Get-WindowsBuildNumber -MockWith { return "25399" }
It 'build number is from Windows 2025' {
Mock Get-WindowsBuildNumber -MockWith { return "26100" }
$windowsPauseVersion = Get-WindowsPauseVersion
$expectedPauseVersion = "ltsc2022"
$windowsPauseVersion | Should -Be $expectedPauseVersion
}

It 'build number is from prerelease of windows 2025' {
It 'build number is from prerelease of windows 2025 (should now fail)' {
Mock Get-WindowsBuildNumber -MockWith { return "30397" }
$windowsPauseVersion = Get-WindowsPauseVersion
$expectedPauseVersion = "ltsc2022"
$windowsPauseVersion | Should -Be $expectedPauseVersion
try {
$windowsPauseVersion = Get-WindowsPauseVersion
} catch {
Write-Host "Expected exception: $_"
}
Assert-MockCalled -CommandName 'Set-ExitCode' -Exactly -Times 1 -ParameterFilter { $ExitCode -eq $global:WINDOWS_CSE_ERROR_NOT_FOUND_BUILD_NUMBER }
}
}

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+CustomCloud/CustomData

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+CustomVnet/CustomData

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S116/CustomData

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S117/CustomData

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S118/CustomData

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S119+CSI/CustomData

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S119+FIPS/CustomData

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSWindows2019+K8S119/CustomData

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading