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
diff --git a/utah/isotest/data/file_list_udi b/utah/isotest/data/file_list_udi
0new file mode 1006440new file mode 100644
index 0000000..926c5c3
--- /dev/null
+++ b/utah/isotest/data/file_list_udi
@@ -0,0 +1,18 @@
1boot
2casper
3.disk
4dists
5EFI
6install
7md5sum.txt
8pool
9preseed
10ubuntu
11casper
12casper/install-sources.yaml
13casper/minimal.squashfs
14casper/minimal.standard.squashfs
15casper/vmlinuz
16casper/initrd
17casper/filesystem.manifest
18casper/filesystem.size
diff --git a/utah/isotest/iso_static_validation.py b/utah/isotest/iso_static_validation.py
index 4480d33..9123813 100755
--- a/utah/isotest/iso_static_validation.py
+++ b/utah/isotest/iso_static_validation.py
@@ -124,9 +124,16 @@ else:
124 st_variant = "legacy-server"124 st_variant = "legacy-server"
125 st_arch = iso.arch125 st_arch = iso.arch
126126
127# Checking the squashfs content to tell legacy vs desktop
128if st_variant == "desktop" and st_release > "kinetic":
129 files = set(iso.listfiles(returnlist=True))
130 if ('install/filesystem.squashfs' in files
131 or './install/filesystem.squashfs' in files):
132 st_variant = "desktop-legacy"
127133
128#Set a flag for ubiquity based images134#Set a flag for ubiquity based images
129if st_variant == 'desktop' or st_variant == 'dvd':135if st_variant == 'desktop-legacy' or st_variant == 'dvd' or \
136 (st_variant == 'desktop' and st_release < 'lunar'):
130 ubiquity_image = True137 ubiquity_image = True
131else:138else:
132 ubiquity_image = False139 ubiquity_image = False
@@ -138,7 +145,7 @@ else:
138 subiquity_image = False145 subiquity_image = False
139146
140#Set a flag for UEFI&SecureBoot147#Set a flag for UEFI&SecureBoot
141if (st_variant in ('desktop', 'server', 'live-server', 'dvd')148if (st_variant in ('desktop', 'desktop-legacy', 'server', 'live-server', 'dvd')
142 and st_arch == 'amd64'):149 and st_arch == 'amd64'):
143 uefi_image = True150 uefi_image = True
144else:151else:
@@ -169,6 +176,8 @@ class TestValidateISO(unittest.TestCase):
169 self.iso = ISO(image=self.iso_location, logger=logging)176 self.iso = ISO(image=self.iso_location, logger=logging)
170 self.st_release = self.iso.series177 self.st_release = self.iso.series
171 self.st_variant = self.iso.installtype178 self.st_variant = self.iso.installtype
179 if self.st_variant == "desktop" and self.st_release > "kinetic":
180 self.st_variant = "desktop-legacy"
172 self.st_arch = self.iso.arch181 self.st_arch = self.iso.arch
173182
174 if self.st_variant == "server" and self.st_release == "focal":183 if self.st_variant == "server" and self.st_release == "focal":
@@ -190,8 +199,10 @@ class TestValidateISO(unittest.TestCase):
190 else:199 else:
191 self.url = DEFAULT_URL200 self.url = DEFAULT_URL
192201
193 if self.st_variant == 'desktop':202 if self.st_variant =='desktop':
194 self.url = os.path.join(self.url, 'daily-live')203 self.url = os.path.join(self.url, 'daily-live')
204 elif self.st_variant =='desktop-legacy':
205 self.url = os.path.join(self.url, 'daily-legacy')
195 elif self.st_variant == 'dvd':206 elif self.st_variant == 'dvd':
196 self.url = os.path.join(self.url, 'dvd')207 self.url = os.path.join(self.url, 'dvd')
197 elif self.st_variant == 'alternate':208 elif self.st_variant == 'alternate':
@@ -295,8 +306,8 @@ class TestValidateISO(unittest.TestCase):
295 '{!r} not found in:\n{}'306 '{!r} not found in:\n{}'
296 .format(fname, stdout))307 .format(fname, stdout))
297308
298 @unittest.skipUnless(ubiquity_image,309 @unittest.skipUnless(ubiquity_image or st_variant == 'desktop',
299 "manifest only for ubiquity based images")310 "manifest only for ubiquity and desktop images")
300 def test_manifest(self):311 def test_manifest(self):
301 """Test if the ISO manifest matches the one in the server."""312 """Test if the ISO manifest matches the one in the server."""
302 manifest_url = os.path.join(313 manifest_url = os.path.join(
@@ -341,7 +352,7 @@ class TestValidateISO(unittest.TestCase):
341 logging.debug('Checking buildids are the same in iso and repo')352 logging.debug('Checking buildids are the same in iso and repo')
342 self.assertIn(id_server, build_info_line)353 self.assertIn(id_server, build_info_line)
343354
344 @unittest.skipUnless(st_variant == 'desktop' and355 @unittest.skipUnless(ubiquity_image == True and
345 st_arch != 'powerpc',356 st_arch != 'powerpc',
346 "Skipping images that aren't ubiquity-based.")357 "Skipping images that aren't ubiquity-based.")
347 @unittest.skipIf(st_release != 'trusty', "Skipping images without wubi.")358 @unittest.skipIf(st_release != 'trusty', "Skipping images without wubi.")
@@ -358,8 +369,8 @@ class TestValidateISO(unittest.TestCase):
358 self.assertEqual(stderr, '')369 self.assertEqual(stderr, '')
359 self.assertIn(" PE32 executable (GUI)", stdout)370 self.assertIn(" PE32 executable (GUI)", stdout)
360371
361 @unittest.skipUnless(st_variant == 'desktop' and372 @unittest.skipUnless(ubiquity_image == True and
362 st_arch != 'powerpc', "Skipping for non desktop iso")373 st_arch != 'powerpc', "Skipping for non desktop legacy iso")
363 def test_files_ubiquity(self):374 def test_files_ubiquity(self):
364 """Test if the relevant files are present in the ISO for desktop."""375 """Test if the relevant files are present in the ISO for desktop."""
365 (stdout, stderr) = self.iso.listfiles()376 (stdout, stderr) = self.iso.listfiles()
@@ -376,9 +387,10 @@ class TestValidateISO(unittest.TestCase):
376 else:387 else:
377 self.assertIn(path, stdout)388 self.assertIn(path, stdout)
378389
379 # Test is skipped for [s]ubiquity based images390 # Test is skipped for [s]ubiquity based and desktop images
380 @unittest.skipIf(ubiquity_image, "Skipping for ubiquity images")391 @unittest.skipIf(ubiquity_image, "Skipping for ubiquity images")
381 @unittest.skipIf(subiquity_image, "Skipping for subiquity images")392 @unittest.skipIf(subiquity_image, "Skipping for subiquity images")
393 @unittest.skipIf(st_variant == 'desktop', "Skipping for desktop images")
382 def test_files_di(self):394 def test_files_di(self):
383 """Test if the relevant files are present for d-i based images ISO.395 """Test if the relevant files are present for d-i based images ISO.
384396
@@ -429,6 +441,19 @@ class TestValidateISO(unittest.TestCase):
429 path = list_server.rstrip()441 path = list_server.rstrip()
430 self.assertIn(path, stdout)442 self.assertIn(path, stdout)
431443
444 @unittest.skipUnless(st_variant == 'desktop' and not ubiquity_image, "Skipping for non desktop iso")
445 def test_files_udi(self):
446 """Test if the relevant files are present for u-d-i isos."""
447 (stdout, stderr) = self.iso.listfiles()
448 logging.debug('Check for error in extracting file list from the iso')
449 self.assertEqual(stderr, '')
450 file_list_path = self.get_latest_file_list("file_list_udi")
451 file_list = open(file_list_path)
452 logging.debug('Check if relevant files are present in the iso')
453 for list_server in file_list:
454 path = list_server.rstrip()
455 self.assertIn(path, stdout)
456
432 @unittest.skipIf(st_arch in ['powerpc', 'ppc64el'],457 @unittest.skipIf(st_arch in ['powerpc', 'ppc64el'],
433 "vmlinuz is not present only for powerpc images")458 "vmlinuz is not present only for powerpc images")
434 def test_vmlinuz(self):459 def test_vmlinuz(self):
@@ -456,7 +481,7 @@ class TestValidateISO(unittest.TestCase):
456 self.assertEqual(stderr, '')481 self.assertEqual(stderr, '')
457 self.assertIn(kernel_string, stdout)482 self.assertIn(kernel_string, stdout)
458483
459 @unittest.skipUnless(ubiquity_image or484 @unittest.skipUnless(ubiquity_image or st_variant == 'desktop' or
460 (st_variant == 'server' and st_release > 'precise'),485 (st_variant == 'server' and st_release > 'precise'),
461 "Skipping for d-i images without squashfs.")486 "Skipping for d-i images without squashfs.")
462 def test_filesystem_squashfs(self):487 def test_filesystem_squashfs(self):
@@ -468,6 +493,8 @@ class TestValidateISO(unittest.TestCase):
468 logging.debug('Extracting the filesystem.squashfs')493 logging.debug('Extracting the filesystem.squashfs')
469 if ubiquity_image:494 if ubiquity_image:
470 squashfs_name = 'casper/filesystem.squashfs'495 squashfs_name = 'casper/filesystem.squashfs'
496 elif st_variant == 'desktop':
497 squashfs_name = 'casper/minimal.squashfs'
471 else:498 else:
472 squashfs_name = 'install/filesystem.squashfs'499 squashfs_name = 'install/filesystem.squashfs'
473500
@@ -484,7 +511,7 @@ class TestValidateISO(unittest.TestCase):
484 self.assertIn("Squashfs filesystem", stdout)511 self.assertIn("Squashfs filesystem", stdout)
485512
486 # Skipping vmlinuz image extraction on server images513 # Skipping vmlinuz image extraction on server images
487 if not ubiquity_image:514 if st_variant == 'server':
488 return515 return
489516
490 #unsquashfs extracts only in pwd517 #unsquashfs extracts only in pwd
@@ -502,7 +529,7 @@ class TestValidateISO(unittest.TestCase):
502529
503 logging.debug('Check that vmlinuz could be extracted')530 logging.debug('Check that vmlinuz could be extracted')
504 self.assertEqual(stderr, '')531 self.assertEqual(stderr, '')
505 self.assertIn("created 1 directories", stdout)532 self.assertIn("created 1 directory", stdout)
506533
507 @unittest.skipUnless(uefi_image,534 @unittest.skipUnless(uefi_image,
508 "Test EFI files on ubuntu amd64 images")535 "Test EFI files on ubuntu amd64 images")

Subscribers

People subscribed via source and target branches