From c25118acc7542e93ccc56a0cc34f32c24b0e1044 Mon Sep 17 00:00:00 2001
From: Daniel Watkins <oddbloke@ubuntu.com>
Date: Tue, 19 Jan 2021 12:40:16 -0500
Subject: integration_tests: log image serial if available (#772)

Ubuntu cloud images ship /etc/cloud/build.info which includes a line
with the build serial used to identify the image:

    serial: 20210108

This is valuable information when verifying Ubuntu issues (to confirm
that testing is happening against the expected image), but is also
useful when debugging test failures: manifests of all packages in (the
base) images can be found at http://cloud-images.ubuntu.com/
---
 tests/integration_tests/clouds.py | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'tests')

diff --git a/tests/integration_tests/clouds.py b/tests/integration_tests/clouds.py
index 72d77058..fc0a61d5 100644
--- a/tests/integration_tests/clouds.py
+++ b/tests/integration_tests/clouds.py
@@ -173,6 +173,9 @@ class IntegrationCloud(ABC):
                 'cloud-init version: %s',
                 instance.execute("cloud-init --version")
             )
+            serial = instance.execute("grep serial /etc/cloud/build.info")
+            if serial:
+                log.info('image serial: %s', serial.split()[1])
         return instance
 
     def get_instance(self, cloud_instance, settings=integration_settings):
-- 
cgit v1.2.3