Merge ~seb128/utah:without-desktop-rename into utah:master

Proposed by Sebastien Bacher
Status: Needs review
Proposed branch: ~seb128/utah:without-desktop-rename
Merge into: utah:master
Diff against target: 175 lines (+57/-12)
2 files modified
utah/isotest/data/file_list_udi (+18/-0)
utah/isotest/iso_static_validation.py (+39/-12)
Reviewer Review Type Date Requested Status
UTAH Dev Pending
Review via email: mp+436867@code.launchpad.net

Commit message

Alternative to https://code.launchpad.net/~seb128/utah/+git/utah/+merge/435880 without doing different variants since tests rely on the st_variant matching the filename. The only exception is desktop-legacy on >= lunar. We already have a ubiquity_image variable which we can use to tell old images vs new

To post a comment you must log in.
Revision history for this message
Heather Ellsworth (hellsworth) wrote (last edit ):

Thanks Seb for working on this! To support your work, I've tested this PR but a few changes were needed to make all of the tests pass. With the following changes, here is my local test log showing all passing tests: https://pastebin.ubuntu.com/p/mW8xNfj3sv/

The only remaining strange thing is that all of the utah*.deb files are put in two places: just outside the root utah directory (as is usual), and then also inside the utah directory but it's not clear to me why they are duplicated. I've just been ignoring the debs inside the utah directory, when building/installing/testing.

Here are the test changes previously mentioned:

1) The change to test_run_utah_tests.py fixes an issue in python 3.11 where 'U' is deprecated.

diff --git a/tests/test_run_utah_tests.py b/tests/test_run_utah_tests.py
index 4c756b40..419c1e68 100644
--- a/tests/test_run_utah_tests.py
+++ b/tests/test_run_utah_tests.py
@@ -29,7 +29,7 @@ server_script_path = os.path.join(os.path.dirname(__file__),
 server_script = imp.load_module('run_utah_tests',
                                 open(server_script_path),
                                 server_script_path,
- ('.py', 'U', 1))
+ ('.py', 'r', 1))

2) A change to iso_static_validation.py to fix the cdimage url used for comparison. Without this change, pointing to a lunar desktop iso generates a file not found error (because self.st_variant was not getting set to equal st_variant):
ERROR: Failed to fetch URL 'http://cdimage.ubuntu.com/daily-legacy/pending/lunar-desktop-amd64.manifest': HTTP Error 404: Not Found

diff --git a/utah/isotest/iso_static_validation.py b/utah/isotest/iso_static_validation.py
index 9123813c..e220a7b9 100755
--- a/utah/isotest/iso_static_validation.py
+++ b/utah/isotest/iso_static_validation.py
@@ -176,7 +176,7 @@ class TestValidateISO(unittest.TestCase):
         self.iso = ISO(image=self.iso_location, logger=logging)
         self.st_release = self.iso.series
         self.st_variant = self.iso.installtype
- if self.st_variant == "desktop" and self.st_release > "kinetic":
+ if self.st_variant == "desktop" and self.st_release < "lunar":
             self.st_variant = "desktop-legacy"
         self.st_arch = self.iso.arch

3) Another change to iso_static_validation.py to remove the .git folder from the secure boot test before doing the sparse checkout, otherwise the test fails because the git checkout fails to reinitialize the git repo.

@@ -563,6 +563,9 @@ class TestValidateISO(unittest.TestCase):
             # so we just pull to ensure it is up to date
             git_keys.pull()
         else:
+ # Remove .git folder before the sparse checkout
+ keys_dot_git = os.path.join(repo_dir, '.git')
+ shutil.rmtree(keys_dot_git)
             git_keys.sparse_checkout(paths=[keys_repo_path])
         cmd = ["make", "-C", keys]
         output = subprocess.Popen(cmd, stdout=subprocess.PIPE,

Revision history for this message
Paride Legovini (paride) wrote :

Thanks Heather! Unfortunately that still doesn't seem to be working with legacy images.

I prepared yet another version of the fix, hopefully covering all the cases of interest.
Here is the MP:

https://code.launchpad.net/~paride/utah/+git/utah-1/+merge/437355

Revision history for this message
Heather Ellsworth (hellsworth) wrote :

Ah dang, I only tested with the latest lunar desktop iso so my apologies for not catching the mistakes. I can go test MP 437355.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks Heather, I've reviewed Paride's merge request but side notes there

1. indeed seems like a pytho3.11 fix which isn't really related to this changeset but needed

2. I think the suggested change isn't correct either because self.st_variant is used to build the iso name and 'desktop-legacy' is part of the name only in Lunar. Paride's variant of change doesn't have that issue though so we can probably consider it resolved if we merge his

3. seems like an improvement worth suggesting but that's an existing problem and not related to the new iso right?

perhaps you could do a merge request with the fix from 3.?

Revision history for this message
Paride Legovini (paride) wrote :

I am not sure I understand when the 3. issue happens: I had a look at the code and looks like we *want* that directory to be a git repo? @Heather maybe it ended up somehow corrupted on your system?

Unmerged commits

fb4596f... by Sebastien Bacher

Update the ISO tests for the new desktop installer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/utah/isotest/data/file_list_udi b/utah/isotest/data/file_list_udi
2new file mode 100644
3index 0000000..926c5c3
4--- /dev/null
5+++ b/utah/isotest/data/file_list_udi
6@@ -0,0 +1,18 @@
7+boot
8+casper
9+.disk
10+dists
11+EFI
12+install
13+md5sum.txt
14+pool
15+preseed
16+ubuntu
17+casper
18+casper/install-sources.yaml
19+casper/minimal.squashfs
20+casper/minimal.standard.squashfs
21+casper/vmlinuz
22+casper/initrd
23+casper/filesystem.manifest
24+casper/filesystem.size
25diff --git a/utah/isotest/iso_static_validation.py b/utah/isotest/iso_static_validation.py
26index 4480d33..9123813 100755
27--- a/utah/isotest/iso_static_validation.py
28+++ b/utah/isotest/iso_static_validation.py
29@@ -124,9 +124,16 @@ else:
30 st_variant = "legacy-server"
31 st_arch = iso.arch
32
33+# Checking the squashfs content to tell legacy vs desktop
34+if st_variant == "desktop" and st_release > "kinetic":
35+ files = set(iso.listfiles(returnlist=True))
36+ if ('install/filesystem.squashfs' in files
37+ or './install/filesystem.squashfs' in files):
38+ st_variant = "desktop-legacy"
39
40 #Set a flag for ubiquity based images
41-if st_variant == 'desktop' or st_variant == 'dvd':
42+if st_variant == 'desktop-legacy' or st_variant == 'dvd' or \
43+ (st_variant == 'desktop' and st_release < 'lunar'):
44 ubiquity_image = True
45 else:
46 ubiquity_image = False
47@@ -138,7 +145,7 @@ else:
48 subiquity_image = False
49
50 #Set a flag for UEFI&SecureBoot
51-if (st_variant in ('desktop', 'server', 'live-server', 'dvd')
52+if (st_variant in ('desktop', 'desktop-legacy', 'server', 'live-server', 'dvd')
53 and st_arch == 'amd64'):
54 uefi_image = True
55 else:
56@@ -169,6 +176,8 @@ class TestValidateISO(unittest.TestCase):
57 self.iso = ISO(image=self.iso_location, logger=logging)
58 self.st_release = self.iso.series
59 self.st_variant = self.iso.installtype
60+ if self.st_variant == "desktop" and self.st_release > "kinetic":
61+ self.st_variant = "desktop-legacy"
62 self.st_arch = self.iso.arch
63
64 if self.st_variant == "server" and self.st_release == "focal":
65@@ -190,8 +199,10 @@ class TestValidateISO(unittest.TestCase):
66 else:
67 self.url = DEFAULT_URL
68
69- if self.st_variant == 'desktop':
70+ if self.st_variant =='desktop':
71 self.url = os.path.join(self.url, 'daily-live')
72+ elif self.st_variant =='desktop-legacy':
73+ self.url = os.path.join(self.url, 'daily-legacy')
74 elif self.st_variant == 'dvd':
75 self.url = os.path.join(self.url, 'dvd')
76 elif self.st_variant == 'alternate':
77@@ -295,8 +306,8 @@ class TestValidateISO(unittest.TestCase):
78 '{!r} not found in:\n{}'
79 .format(fname, stdout))
80
81- @unittest.skipUnless(ubiquity_image,
82- "manifest only for ubiquity based images")
83+ @unittest.skipUnless(ubiquity_image or st_variant == 'desktop',
84+ "manifest only for ubiquity and desktop images")
85 def test_manifest(self):
86 """Test if the ISO manifest matches the one in the server."""
87 manifest_url = os.path.join(
88@@ -341,7 +352,7 @@ class TestValidateISO(unittest.TestCase):
89 logging.debug('Checking buildids are the same in iso and repo')
90 self.assertIn(id_server, build_info_line)
91
92- @unittest.skipUnless(st_variant == 'desktop' and
93+ @unittest.skipUnless(ubiquity_image == True and
94 st_arch != 'powerpc',
95 "Skipping images that aren't ubiquity-based.")
96 @unittest.skipIf(st_release != 'trusty', "Skipping images without wubi.")
97@@ -358,8 +369,8 @@ class TestValidateISO(unittest.TestCase):
98 self.assertEqual(stderr, '')
99 self.assertIn(" PE32 executable (GUI)", stdout)
100
101- @unittest.skipUnless(st_variant == 'desktop' and
102- st_arch != 'powerpc', "Skipping for non desktop iso")
103+ @unittest.skipUnless(ubiquity_image == True and
104+ st_arch != 'powerpc', "Skipping for non desktop legacy iso")
105 def test_files_ubiquity(self):
106 """Test if the relevant files are present in the ISO for desktop."""
107 (stdout, stderr) = self.iso.listfiles()
108@@ -376,9 +387,10 @@ class TestValidateISO(unittest.TestCase):
109 else:
110 self.assertIn(path, stdout)
111
112- # Test is skipped for [s]ubiquity based images
113+ # Test is skipped for [s]ubiquity based and desktop images
114 @unittest.skipIf(ubiquity_image, "Skipping for ubiquity images")
115 @unittest.skipIf(subiquity_image, "Skipping for subiquity images")
116+ @unittest.skipIf(st_variant == 'desktop', "Skipping for desktop images")
117 def test_files_di(self):
118 """Test if the relevant files are present for d-i based images ISO.
119
120@@ -429,6 +441,19 @@ class TestValidateISO(unittest.TestCase):
121 path = list_server.rstrip()
122 self.assertIn(path, stdout)
123
124+ @unittest.skipUnless(st_variant == 'desktop' and not ubiquity_image, "Skipping for non desktop iso")
125+ def test_files_udi(self):
126+ """Test if the relevant files are present for u-d-i isos."""
127+ (stdout, stderr) = self.iso.listfiles()
128+ logging.debug('Check for error in extracting file list from the iso')
129+ self.assertEqual(stderr, '')
130+ file_list_path = self.get_latest_file_list("file_list_udi")
131+ file_list = open(file_list_path)
132+ logging.debug('Check if relevant files are present in the iso')
133+ for list_server in file_list:
134+ path = list_server.rstrip()
135+ self.assertIn(path, stdout)
136+
137 @unittest.skipIf(st_arch in ['powerpc', 'ppc64el'],
138 "vmlinuz is not present only for powerpc images")
139 def test_vmlinuz(self):
140@@ -456,7 +481,7 @@ class TestValidateISO(unittest.TestCase):
141 self.assertEqual(stderr, '')
142 self.assertIn(kernel_string, stdout)
143
144- @unittest.skipUnless(ubiquity_image or
145+ @unittest.skipUnless(ubiquity_image or st_variant == 'desktop' or
146 (st_variant == 'server' and st_release > 'precise'),
147 "Skipping for d-i images without squashfs.")
148 def test_filesystem_squashfs(self):
149@@ -468,6 +493,8 @@ class TestValidateISO(unittest.TestCase):
150 logging.debug('Extracting the filesystem.squashfs')
151 if ubiquity_image:
152 squashfs_name = 'casper/filesystem.squashfs'
153+ elif st_variant == 'desktop':
154+ squashfs_name = 'casper/minimal.squashfs'
155 else:
156 squashfs_name = 'install/filesystem.squashfs'
157
158@@ -484,7 +511,7 @@ class TestValidateISO(unittest.TestCase):
159 self.assertIn("Squashfs filesystem", stdout)
160
161 # Skipping vmlinuz image extraction on server images
162- if not ubiquity_image:
163+ if st_variant == 'server':
164 return
165
166 #unsquashfs extracts only in pwd
167@@ -502,7 +529,7 @@ class TestValidateISO(unittest.TestCase):
168
169 logging.debug('Check that vmlinuz could be extracted')
170 self.assertEqual(stderr, '')
171- self.assertIn("created 1 directories", stdout)
172+ self.assertIn("created 1 directory", stdout)
173
174 @unittest.skipUnless(uefi_image,
175 "Test EFI files on ubuntu amd64 images")

Subscribers

People subscribed via source and target branches