Exemple #1
0
 def test_a_less_than_b_false(self):
     self.assertFalse(
         release_a_newer_than_b(
             factory.make_kernel_string(can_be_release_or_version=True),
             "hwe-rolling",
         )
     )
Exemple #2
0
 def test_a_newer_than_b_true(self):
     self.assertTrue(
         release_a_newer_than_b(
             "hwe-rolling",
             factory.make_kernel_string(can_be_release_or_version=True),
         )
     )
Exemple #3
0
def make_default_min_hwe_kernel_field(*args, **kwargs):
    """Build and return the default_min_hwe_kernel field."""
    kernel_choices = [("", "--- No minimum kernel ---")]
    # Global choices are limited to the commissioning release as min_hwe_kernel
    # is used during commissioning.
    commissioning_series = Config.objects.get_config(
        "commissioning_distro_series"
    )
    if commissioning_series:
        commissioning_os_release = "ubuntu/" + commissioning_series
        kernel_choices += list_hwe_kernel_choices(
            [
                kernel
                for kernel in BootResource.objects.get_usable_hwe_kernels(
                    commissioning_os_release
                )
                if release_a_newer_than_b(kernel, commissioning_series)
            ]
        )
    field = forms.ChoiceField(
        initial=Config.objects.get_config("default_min_hwe_kernel"),
        choices=kernel_choices,
        error_messages={
            "invalid_choice": compose_invalid_choice_text(
                "default_min_hwe_kernel", kernel_choices
            )
        },
        **kwargs
    )
    return field
Exemple #4
0
 def get_unsupported_arches(release):
     # The boot resources front and back end were both built with the idea
     # that every Ubuntu release is supported on every architecture.
     # 20.04 and above has dropped i386 support. Due to the way the
     # websocket is setup its more effecient to get this information
     # based on version than from the database.
     try:
         if release_a_newer_than_b(release, "20.04"):
             return ["i386"]
     except ValueError:
         # Unknown Ubuntu release, should only happen during testing.
         pass
     return []
Exemple #5
0
 def test_kernel_flavor_doesnt_make_difference(self):
     self.assertTrue(
         release_a_newer_than_b("hwe-rolling", "hwe-rolling-lowlatency")
     )
Exemple #6
0
 def test_accounts_for_edge(self):
     self.assertFalse(
         release_a_newer_than_b("hwe-rolling", "hwe-rolling-edge")
     )
Exemple #7
0
 def test_a_equal_to_b_true(self):
     string = factory.make_kernel_string(can_be_release_or_version=True)
     self.assertTrue(release_a_newer_than_b(string, string))