Skip to content

Commit a7eac1c

Browse files
DevinwongCopilot
andauthored
test(e2e): add ANC hotfix binary selection E2E test (#8423)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent af5a4b7 commit a7eac1c

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

e2e/scenario_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,54 @@ func Test_Ubuntu2204_ScriptlessCSECmd_Hotfix(t *testing.T) {
643643
})
644644
}
645645

646+
// Test_Ubuntu2204_ANCHotfix_BinarySelection tests that the wrapper script correctly
647+
// selects a pre-existing hotfix binary over the VHD-baked binary. This validates the
648+
// wrapper's binary selection logic without requiring an actual PMC download.
649+
// A stub script at the hotfix binary path delegates to the real ANC binary.
650+
//
651+
// Note: In the EnableScriptlessCSECmd (non-NBC) path, the wrapper runs at boot and
652+
// performs binary selection, but exits before provisioning because no config/nbc-cmd
653+
// file exists at that point. Provisioning happens later via CSE → provision.sh.
654+
// This test validates the wrapper's selection logic; node readiness (implicit in
655+
// RunScenario) confirms provisioning succeeded via the CSE path.
656+
func Test_Ubuntu2204_ANCHotfix_BinarySelection(t *testing.T) {
657+
RunScenario(t, &Scenario{
658+
Description: "tests that the wrapper selects a pre-seeded hotfix binary",
659+
Config: Config{
660+
Cluster: ClusterKubenet,
661+
VHD: config.VHDUbuntu2204Gen2Containerd,
662+
CustomDataWriteFiles: []CustomDataWriteFile{
663+
{
664+
// Hotfix JSON — triggers download-hotfix, but a real hotfix install
665+
// should be skipped because this intentionally old version will not
666+
// target the VHD base version. The pre-seeded binary below will still
667+
// be found and selected by the wrapper.
668+
Path: "/opt/azure/containers/aks-node-controller-hotfix.json",
669+
Content: `{"version":"200001.01.1"}`,
670+
},
671+
{
672+
// Pre-seed the hotfix binary path with a stub script that delegates
673+
// to the real VHD-baked ANC binary. This simulates a successful
674+
// hotfix download without needing PMC.
675+
Path: "/opt/azure/containers/aks-node-controller-hotfix",
676+
Permissions: "0755",
677+
Content: "#!/bin/bash\nexec /opt/azure/containers/aks-node-controller \"$@\"",
678+
},
679+
},
680+
BootstrapConfigMutator: func(nbc *datamodel.NodeBootstrappingConfiguration) {
681+
nbc.EnableScriptlessCSECmd = true
682+
},
683+
Validator: func(ctx context.Context, s *Scenario) {
684+
// Wrapper found the pre-seeded hotfix binary and selected it
685+
ValidateJournalctlOutput(ctx, s, "aks-node-controller.service", "Using hotfix binary")
686+
// download-hotfix was triggered by the hotfix JSON
687+
ValidateFileHasContent(ctx, s, "/var/log/azure/aks-node-controller.log",
688+
"aks-node-controller hotfix download finished")
689+
},
690+
},
691+
})
692+
}
693+
646694
// Returns config for the 'gpu' E2E scenario
647695
func Test_Ubuntu2204(t *testing.T) {
648696
RunScenario(t, &Scenario{

0 commit comments

Comments
 (0)