Skip to content

Commit 40c5a99

Browse files
authored
Fix test cases for Azure Linux (#3610)
* Fix test cases for Azure Linux * Handle PR comment * Handle pr check failure * Fix PR checks * Handle PR comments * Fix for PR check failure * Fix for PR check failure * Handle PR comment to spilt regex * PR check fix * PR check fix * PR check fix 3 * PR check fix 4 * Fix syntax * Fix minor change in regex pattern
1 parent 51fe1f5 commit 40c5a99

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

microsoft/testsuites/core/azure_image_standard.py

+57-1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,36 @@ class AzureImageStandard(TestSuite):
249249
r"^(.*mlx5_core0: WARN: mlx5_fwdump_prep:92:\(pid 0\).*)$",
250250
re.M,
251251
),
252+
# ACPI failback to PDC
253+
re.compile(
254+
r"^(.* ACPI: _OSC evaluation for CPUs failed, trying _PDC\r)$",
255+
re.M,
256+
),
257+
# Buffer I/O error on dev sr0, logical block 1, async page read
258+
re.compile(
259+
r"^(.*Buffer I/O error on dev sr0, logical block 1, async page read\r)$",
260+
re.M,
261+
),
262+
# I/O error,dev sr0,sector 8 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 2
263+
# I/O error,dev sr0,sector 8 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
264+
re.compile(
265+
r"^(.* I/O error, dev sr0, sector 8 op 0x0:\(READ\) flags 0x[0-9a-fA-F]+ phys_seg 1 prio class 2\r)$", # noqa: E501
266+
re.M,
267+
),
268+
# 2025-01-16T08:51:16.449922+00:00 azurelinux kernel: audit: type=1103
269+
# audit(1737017476.442:257): pid=1296 uid=0 auid=4294967295 ses=4294967295
270+
# subj=unconfined msg=\'op=PAM:setcred grantors=? acct="l****t"
271+
# exe="/usr/lib/systemd/systemd-executor" hostname=? addr=?terminal=?res=failed
272+
re.compile(
273+
r"(?P<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}\+00:00\s)?"
274+
r"(?P<hostname>[a-zA-Z0-9\-]+)\s(kernel:\s)?\[\s*(?P<kernel_time>\d+\.\d+)\s*\]" # noqa: E501
275+
r"(?:\s*)?audit:\s+type=(?P<type>\d+)\s+audit\((?P<audit_time>\d+\.\d+):"
276+
r"(?P<audit_id>\d+)\):\s+pid=(?P<pid>\d+)\s+uid=(?P<uid>\d+)\s+auid="
277+
r"(?P<auid>\d+)\s+ses=(?P<ses>\d+)\s+subj=(?P<subj>[a-zA-Z0-9\-]+)\s+"
278+
r"msg=\'op=PAM:setcred\s+grantors=\?[\s\S]*?acct=\"(?P<acct>[a-zA-Z0-9\*\-]+)\"" # noqa: E501
279+
r"\s+exe=\"(?P<exe>[^\"]+)\"\s+hostname=\? addr=\? terminal=\? res="
280+
r"(?P<res>[a-zA-Z]+)\'\r"
281+
),
252282
]
253283

254284
@TestCaseMetadata(
@@ -393,6 +423,13 @@ def verify_network_file_configuration(self, node: Node) -> None:
393423
network_file.upper(),
394424
f"networking=yes should be present in {network_file_path}",
395425
).contains("networking=yes".upper())
426+
elif isinstance(node.os, CBLMariner):
427+
network_file_path = "/etc/systemd/networkd.conf"
428+
file_exists = node.shell.exists(PurePosixPath(network_file_path))
429+
assert_that(
430+
file_exists,
431+
f"The network file should be present at {network_file_path}",
432+
).is_true()
396433
else:
397434
raise SkippedException(f"unsupported distro type: {type(node.os)}")
398435

@@ -449,7 +486,7 @@ def verify_udev_rules_moved(self, node: Node) -> None:
449486
"/usr/lib64/udev/rules.d/75-persistent-net-generator.rules"
450487
)
451488
udev_file_path_70_rule = "/usr/lib64/udev/rules.d/70-persistent-net.rules"
452-
elif isinstance(node.os, Fedora):
489+
elif isinstance(node.os, Fedora) or isinstance(node.os, CBLMariner):
453490
udev_file_path_75_rule = (
454491
"/lib/udev/rules.d/75-persistent-net-generator.rules"
455492
)
@@ -497,6 +534,25 @@ def verify_dhcp_file_configuration(self, node: Node) -> None:
497534
'DHCLIENT_SET_HOSTNAME="no" should be present in '
498535
f"file {dhcp_file_path}",
499536
).contains('DHCLIENT_SET_HOSTNAME="no"')
537+
elif isinstance(node.os, CBLMariner):
538+
if node.os.information.version.major == 3:
539+
dhcp_file_path = "/etc/dhcpcd.conf"
540+
dhcp_file_content = "option host_name"
541+
else:
542+
dhcp_file_path = "/etc/dhcp/dhclient.conf"
543+
dhcp_file_content = "host-name"
544+
file_exists = node.shell.exists(PurePosixPath(dhcp_file_path))
545+
546+
assert_that(
547+
file_exists,
548+
f"The dhcp file should be present at {dhcp_file_path}",
549+
).is_true()
550+
551+
dhcp_file = node.tools[Cat].read(dhcp_file_path)
552+
assert_that(
553+
dhcp_file,
554+
f"option host_name should be present in file {dhcp_file_path}",
555+
).contains(dhcp_file_content)
500556
else:
501557
raise SkippedException(f"Unsupported distro type : {type(node.os)}")
502558

0 commit comments

Comments
 (0)