Skip to content

Commit b53f240

Browse files
author
Ramkumar Chinchani
committed
feat: update tests for certificate endpoint mode handling and refresh schedule installation
1 parent 9ab4d52 commit b53f240

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

spec/parts/linux/cloud-init/artifacts/init_aks_custom_cloud_spec.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,34 @@ Describe 'init-aks-custom-cloud.sh refresh mode wiring'
1717
It 'always derives cert endpoint mode from refresh_location'
1818
When run grep -Eq '^location_normalized="\$\{refresh_location,,\}"$' "$script_path"
1919
The status should eq 0
20+
End
2021

22+
It 'maps ussec/usnat locations to legacy cert endpoint mode'
2123
When run grep -Eq 'ussec\*|usnat\*\) cert_endpoint_mode="legacy"' "$script_path"
2224
The status should eq 0
2325
End
2426

25-
It 'installs refresh schedule only for legacy mode or opted-in rcv1p mode'
27+
It 'initializes refresh schedule installation as disabled'
2628
When run grep -Eq '^install_ca_refresh_schedule=0$' "$script_path"
2729
The status should eq 0
30+
End
2831

32+
It 'enables refresh schedule installation for eligible certificate modes'
2933
When run grep -Eq '^[[:space:]]*install_ca_refresh_schedule=1$' "$script_path"
3034
The status should eq 0
35+
End
3136

37+
It 'gates refresh schedule installation on install_ca_refresh_schedule'
3238
When run grep -Eq '^[[:space:]]*if \[ "\$install_ca_refresh_schedule" -eq 1 \]; then$' "$script_path"
3339
The status should eq 0
3440
End
3541

36-
It 'exits early in ca-refresh mode after certificate refresh logic'
42+
It 'checks for ca-refresh mode after certificate refresh logic'
3743
When run grep -Eq '^if \[ "\$action" = "ca-refresh" \]; then$' "$script_path"
3844
The status should eq 0
45+
End
3946

47+
It 'exits early in ca-refresh mode after certificate refresh logic'
4048
When run grep -Eq '^[[:space:]]*exit$' "$script_path"
4149
The status should eq 0
4250
End

staging/cse/windows/kubernetesfunc.tests.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ function Register-ScheduledTask {
4848
param($TaskName, $InputObject)
4949
}
5050

51-
. $PSScriptRoot\..\..\..\parts\windows\windowscsehelper.ps1
52-
. $PSCommandPath.Replace('.tests.ps1', '.ps1')
51+
$helperScriptPath = Join-Path $PSScriptRoot '..\..\..\parts\windows\windowscsehelper.ps1'
52+
$scriptUnderTestPath = Join-Path $PSScriptRoot 'kubernetesfunc.ps1'
53+
54+
. $helperScriptPath
55+
. $scriptUnderTestPath
5356

5457
Describe 'Get-CustomCloudCertEndpointModeFromLocation' {
5558
It 'returns legacy for ussec regions' {

0 commit comments

Comments
 (0)