Skip to content

Commit

Permalink
test: add test for lts kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
anujmaheshwari1 committed Feb 13, 2025
1 parent 932e26d commit 140acd6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion vhdbuilder/packer/pre-install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ if [[ ${OS} == ${MARINER_OS_NAME} ]] && [[ "${ENABLE_CGROUPV2,,}" == "true" ]];
enableCgroupV2forAzureLinux
fi

if [[ "${OS}" == "${UBUNTU_OS_NAME}" && "${ENABLE_FIPS,,}" != "true" ]]; then
if [[ ${UBUNTU_RELEASE//./} -ge 2204 && "${ENABLE_FIPS,,}" != "true" ]]; then
LTS_KERNEL="linux-image-azure-lts-${UBUNTU_RELEASE}"
LTS_TOOLS="linux-tools-azure-lts-${UBUNTU_RELEASE}"
LTS_CLOUD_TOOLS="linux-cloud-tools-azure-lts-${UBUNTU_RELEASE}"
Expand Down
47 changes: 32 additions & 15 deletions vhdbuilder/packer/test/linux-vhd-content-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -408,20 +408,36 @@ testFips() {
echo "$test:Finish"
}

#testLtsKernel() {
# test="testLtsKernel"
# echo "$test:Start"
# os_version=$1
# os_sku=$2
# enable_fips=$3
#
# if [[ "$os_sku" == "Ubuntu" && ${enable_fips,,} != "true" ]]; then
# echo "OS is Ubuntu and FIPS is not enabled, check LTS kernel version"
# kernel=$(uname -r)
# else
# echo "OS is not Ubuntu, skip LTS kernel test"
# fi
#}
testLtsKernel() {
test="testLtsKernel"
echo "$test:Start"
os_version=$1
os_sku=$2
enable_fips=$3

if [[ "$os_sku" == "Ubuntu" && ${enable_fips,,} != "true" ]]; then
echo "OS is Ubuntu and FIPS is not enabled, check LTS kernel version"
# Check the Ubuntu version and set the expected kernel version
if [[ "$os_version" == "2204" ]]; then
expected_kernel="5.15"
elif [[ "$os_version" == "2404" ]]; then
expected_kernel="6.8"
else
echo "LTS kernel not installed for: $os_version"
fi

kernel=$(uname -r)
echo "Current kernel version: $kernel"
if [[ "$kernel" == *"$expected_kernel"* ]]; then
echo "Kernel version is as expected ($expected_kernel)."
else
echo "Kernel version is not as expected. Expected $expected_kernel, found $kernel."
fi
else
echo "OS is not Ubuntu, skip LTS kernel test"
fi

}

testCloudInit() {
test="testCloudInit"
Expand Down Expand Up @@ -1175,4 +1191,5 @@ testPam $OS_SKU $OS_VERSION
testUmaskSettings
testContainerImagePrefetchScript
testAKSNodeControllerBinary
testAKSNodeControllerService
testAKSNodeControllerService
testLtsKernel $OS_VERSION $OS_SKU $ENABLE_FIPS

0 comments on commit 140acd6

Please sign in to comment.