[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC XEN PATCH 07/13] pytest: Add random string to look for in the logs



From: Anthony PERARD <anthony.perard@xxxxxxxxxx>

This allow to check that we are testing the expected rootfs.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 automation/pytest/test_boot.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/automation/pytest/test_boot.py b/automation/pytest/test_boot.py
index 158f1a30dcb6..90d8e00e90d9 100644
--- a/automation/pytest/test_boot.py
+++ b/automation/pytest/test_boot.py
@@ -2,6 +2,8 @@ import logging
 import os
 from pathlib import Path
 import pytest
+import random
+import string
 from typing import Generator
 
 from lib.boot_binary import BootBinary
@@ -14,14 +16,20 @@ def xenroot_path() -> Path:
     return Path("../..").resolve()
 
 
+@pytest.fixture
+def boot_string() -> str:
+    return ''.join(random.choice(string.ascii_letters) for _ in range(16))
+
+
 @pytest.fixture
 def prepare_rootfs(tmp_path: Path,
                    xenroot_path: Path,
+                   boot_string: str,
                    ) -> BootBinary:
     static_gateway = os.environ['HOST_IP_GATEWAY']
     http_pxe_path = os.environ["PXE_HTTP_PATH"]
 
-    boot_script = f"echo Dom0 ready\n"
+    boot_script = f"echo Dom0 ready {boot_string}\n"
 
     return BootBinary(tmp_path,
                       xenroot_path,
@@ -65,8 +73,9 @@ def machine_on_ipmi(prepare_netboot: None) -> Generator[IPMI]:
 
 @pytest.mark.timeout(600)
 def test_xen_tools_tests(machine_on_ipmi: IPMI,
+                         boot_string: str,
                          ) -> None:
-    expect_string = "Dom0 ready"
+    expect_string = boot_string
     for line in machine_on_ipmi.console_output_generator():
         #
         # Wait for `expect_string` for the test to succeed
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.