@@ -1170,57 +1170,57 @@ func ValidateLocalDNSResolution(ctx context.Context, s *Scenario, server string)
11701170 assert .Contains (s .T , execResult .stdout .String (), fmt .Sprintf ("SERVER: %s" , server ))
11711171}
11721172
1173- func validateLocalDNSCorefileRegeneration (ctx context.Context , s * Scenario ) {
1174- ValidateLocalDNSService (ctx , s , "enabled" )
1175-
1176- // Validate systemd drop-in file exists with correct environment variable
1177- dropinFile := "/etc/systemd/system/localdns.service.d/10-localdns-environment.conf"
1178- ValidateFileExists (ctx , s , dropinFile )
1179- ValidateFileHasContent (ctx , s , dropinFile , "[Service]" )
1180- ValidateFileHasContent (ctx , s , dropinFile , "Environment=\" LOCALDNS_BASE64_ENCODED_COREFILE=" )
1181-
1182- // Validate original corefile exists
1183- corefilePath := "/opt/azure/containers/localdns/localdns.corefile"
1184- ValidateFileExists (ctx , s , corefilePath )
1185-
1186- // Test corefile regeneration: delete corefile and restart service
1187- s .T .Log ("Testing corefile regeneration after deletion..." )
1188- script := `set -euo pipefail
1189- # Delete the corefile
1190- sudo rm -f /opt/azure/containers/localdns/localdns.corefile
1191-
1192- # Verify file is deleted
1193- if [ -f /opt/azure/containers/localdns/localdns.corefile ]; then
1194- echo "ERROR: Corefile still exists after deletion"
1195- exit 1
1196- fi
1197-
1198- # Restart localdns service
1199- sudo systemctl restart localdns
1200-
1201- # Wait for service to be active
1202- sleep 2
1203- systemctl is-active localdns
1204-
1205- # Verify corefile was regenerated
1206- if [ ! -f /opt/azure/containers/localdns/localdns.corefile ]; then
1207- echo "ERROR: Corefile was not regenerated"
1208- exit 1
1209- fi
1210-
1211- echo "SUCCESS: Corefile regenerated successfully"
1212- exit 0
1213- `
1214- execScriptOnVMForScenarioValidateExitCode (ctx , s , script , 0 , "corefile regeneration test failed" )
1215-
1216- // Validate localdns service is still running after regeneration
1217- ValidateLocalDNSService (ctx , s , "enabled" )
1218-
1219- // Validate DNS resolution still works
1220- ValidateLocalDNSResolution (ctx , s , "169.254.10.10" )
1221-
1222- s .T .Log ("All localdns corefile regeneration tests passed successfully" )
1223- }
1173+ // func validateLocalDNSCorefileRegeneration(ctx context.Context, s *Scenario) {
1174+ // ValidateLocalDNSService(ctx, s, "enabled")
1175+
1176+ // // Validate systemd drop-in file exists with correct environment variable
1177+ // dropinFile := "/etc/systemd/system/localdns.service.d/10-localdns-environment.conf"
1178+ // ValidateFileExists(ctx, s, dropinFile)
1179+ // ValidateFileHasContent(ctx, s, dropinFile, "[Service]")
1180+ // ValidateFileHasContent(ctx, s, dropinFile, "Environment=\"LOCALDNS_BASE64_ENCODED_COREFILE=")
1181+
1182+ // // Validate original corefile exists
1183+ // corefilePath := "/opt/azure/containers/localdns/localdns.corefile"
1184+ // ValidateFileExists(ctx, s, corefilePath)
1185+
1186+ // // Test corefile regeneration: delete corefile and restart service
1187+ // s.T.Log("Testing corefile regeneration after deletion...")
1188+ // script := `set -euo pipefail
1189+ // # Delete the corefile
1190+ // sudo rm -f /opt/azure/containers/localdns/localdns.corefile
1191+
1192+ // # Verify file is deleted
1193+ // if [ -f /opt/azure/containers/localdns/localdns.corefile ]; then
1194+ // echo "ERROR: Corefile still exists after deletion"
1195+ // exit 1
1196+ // fi
1197+
1198+ // # Restart localdns service
1199+ // sudo systemctl restart localdns
1200+
1201+ // # Wait for service to be active
1202+ // sleep 2
1203+ // systemctl is-active localdns
1204+
1205+ // # Verify corefile was regenerated
1206+ // if [ ! -f /opt/azure/containers/localdns/localdns.corefile ]; then
1207+ // echo "ERROR: Corefile was not regenerated"
1208+ // exit 1
1209+ // fi
1210+
1211+ // echo "SUCCESS: Corefile regenerated successfully"
1212+ // exit 0
1213+ // `
1214+ // execScriptOnVMForScenarioValidateExitCode(ctx, s, script, 0, "corefile regeneration test failed")
1215+
1216+ // // Validate localdns service is still running after regeneration
1217+ // ValidateLocalDNSService(ctx, s, "enabled")
1218+
1219+ // // Validate DNS resolution still works
1220+ // ValidateLocalDNSResolution(ctx, s, "169.254.10.10")
1221+
1222+ // s.T.Log("All localdns corefile regeneration tests passed successfully")
1223+ // }
12241224
12251225// ValidateJournalctlOutput checks if specific content exists in the systemd service logs
12261226func ValidateJournalctlOutput (ctx context.Context , s * Scenario , serviceName string , expectedContent string ) {
0 commit comments