Skip to content

Commit

Permalink
chore(bases): bump compatibility tag to v4 (#465)
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <[email protected]>
  • Loading branch information
mr-cal authored Nov 30, 2023
1 parent d5c194b commit 029c322
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion craft_providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Base(ABC):
_timeout_unpredictable: Optional[float] = TIMEOUT_UNPREDICTABLE
_cache_path: Optional[pathlib.Path] = None
alias: Enum
compatibility_tag: str = "base-v3"
compatibility_tag: str = "base-v4"

@abstractmethod
def __init__(
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/lxd/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_base_instance():
def _base_instance(
image_name: str = "22.04",
image_remote: str = "ubuntu",
compatibility_tag: str = "buildd-base-v3",
compatibility_tag: str = "buildd-base-v4",
project: str = "default",
):
"""Get the base instance."""
Expand Down Expand Up @@ -302,7 +302,7 @@ def test_launch_create_base_instance_with_correct_image_description(

assert (
lxc_result[0]["expanded_config"]["image.description"]
== "base-instance-buildd-base-v3-ubuntu-22.04"
== "base-instance-buildd-base-v4-ubuntu-22.04"
)


Expand Down Expand Up @@ -704,7 +704,7 @@ def test_launch_instance_config_incompatible_without_auto_clean(

assert exc_info.value.brief == (
"Incompatible base detected:"
" Expected image compatibility tag 'buildd-base-v3', found 'invalid'."
" Expected image compatibility tag 'buildd-base-v4', found 'invalid'."
)


Expand Down Expand Up @@ -737,7 +737,7 @@ def test_launch_instance_not_setup_without_auto_clean(
"""Raise an error if an existing instance is not setup and auto_clean is False."""
core22_instance.push_file_io(
destination=base_configuration._instance_config_path,
content=io.BytesIO(b"compatibility_tag: buildd-base-v3\nsetup: false\n"),
content=io.BytesIO(b"compatibility_tag: buildd-base-v4\nsetup: false\n"),
file_mode="0644",
)

Expand All @@ -758,7 +758,7 @@ def test_launch_instance_not_setup_with_auto_clean(base_configuration, core22_in
"""Clean the instance if it is not setup and auto_clean is True."""
core22_instance.push_file_io(
destination=base_configuration._instance_config_path,
content=io.BytesIO(b"compatibility_tag: buildd-base-v3\nsetup: false\n"),
content=io.BytesIO(b"compatibility_tag: buildd-base-v4\nsetup: false\n"),
file_mode="0644",
)

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/multipass/test_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_launch_instance_config_incompatible_instance(core22_instance):

assert exc_info.value.brief == (
"Incompatible base detected:"
" Expected image compatibility tag 'buildd-base-v3', found 'invalid'."
" Expected image compatibility tag 'buildd-base-v4', found 'invalid'."
)

# Retry with auto_clean=True.
Expand All @@ -178,7 +178,7 @@ def test_launch_instance_not_setup_without_auto_clean(core22_instance):

core22_instance.push_file_io(
destination=base_configuration._instance_config_path,
content=io.BytesIO(b"compatibility_tag: buildd-base-v3\nsetup: false\n"),
content=io.BytesIO(b"compatibility_tag: buildd-base-v4\nsetup: false\n"),
file_mode="0644",
)

Expand All @@ -200,7 +200,7 @@ def test_launch_instance_not_setup_with_auto_clean(core22_instance):

core22_instance.push_file_io(
destination=base_configuration._instance_config_path,
content=io.BytesIO(b"compatibility_tag: buildd-base-v3\nsetup: false\n"),
content=io.BytesIO(b"compatibility_tag: buildd-base-v4\nsetup: false\n"),
file_mode="0644",
)

Expand Down
20 changes: 10 additions & 10 deletions tests/unit/bases/test_almalinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
def mock_load(mocker):
return mocker.patch(
"craft_providers.instance_config.InstanceConfiguration.load",
return_value=InstanceConfiguration(compatibility_tag="almalinux-base-v3"),
return_value=InstanceConfiguration(compatibility_tag="almalinux-base-v4"),
)


Expand Down Expand Up @@ -149,7 +149,7 @@ def mock_get_os_release(mocker):
],
)
@pytest.mark.parametrize(
("tag", "expected_tag"), [(None, "almalinux-base-v3"), ("test-tag", "test-tag")]
("tag", "expected_tag"), [(None, "almalinux-base-v4"), ("test-tag", "test-tag")]
)
def test_setup(
fake_process,
Expand Down Expand Up @@ -653,7 +653,7 @@ def test_ensure_image_version_compatible_failure(fake_executor, monkeypatch):
base_config._ensure_instance_config_compatible(executor=fake_executor)

assert exc_info.value == BaseCompatibilityError(
"Expected image compatibility tag 'almalinux-base-v3', found 'invalid-tag'"
"Expected image compatibility tag 'almalinux-base-v4', found 'invalid-tag'"
)


Expand Down Expand Up @@ -1056,7 +1056,7 @@ def test_update_setup_status(fake_executor, mock_load, status):
assert fake_executor.records_of_push_file_io == [
{
"content": (
"compatibility_tag: almalinux-base-v3\n"
"compatibility_tag: almalinux-base-v4\n"
f"setup: {str(status).lower()}\n".encode()
),
"destination": "/etc/craft-instance.conf",
Expand Down Expand Up @@ -1165,7 +1165,7 @@ def test_warmup_overall(
environment, fake_process, fake_executor, mock_load, mocker, cache_path
):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="almalinux-base-v3", setup=True
compatibility_tag="almalinux-base-v4", setup=True
)
alias = almalinux.AlmaLinuxBaseAlias.NINE

Expand Down Expand Up @@ -1220,7 +1220,7 @@ def test_warmup_overall(

def test_warmup_bad_os(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="almalinux-base-v3", setup=True
compatibility_tag="almalinux-base-v4", setup=True
)
base_config = almalinux.AlmaLinuxBase(
alias=almalinux.AlmaLinuxBaseAlias.NINE,
Expand All @@ -1245,7 +1245,7 @@ def test_warmup_bad_os(fake_process, fake_executor, mock_load):

def test_warmup_bad_instance_config(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="almalinux-base-v3", setup=True
compatibility_tag="almalinux-base-v4", setup=True
)
alias = almalinux.AlmaLinuxBaseAlias.NINE
base_config = almalinux.AlmaLinuxBase(
Expand Down Expand Up @@ -1274,7 +1274,7 @@ def test_warmup_bad_instance_config(fake_process, fake_executor, mock_load):
def test_warmup_not_setup(setup, fake_process, fake_executor, mock_load):
"""Raise a BaseConfigurationError if the instance is not setup."""
mock_load.return_value = InstanceConfiguration(
compatibility_tag="almalinux-base-v3", setup=setup
compatibility_tag="almalinux-base-v4", setup=setup
)
alias = almalinux.AlmaLinuxBaseAlias.NINE
base_config = almalinux.AlmaLinuxBase(
Expand Down Expand Up @@ -1302,7 +1302,7 @@ def test_warmup_not_setup(setup, fake_process, fake_executor, mock_load):

def test_warmup_never_ready(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="almalinux-base-v3", setup=True
compatibility_tag="almalinux-base-v4", setup=True
)
alias = almalinux.AlmaLinuxBaseAlias.NINE
base_config = almalinux.AlmaLinuxBase(
Expand Down Expand Up @@ -1335,7 +1335,7 @@ def test_warmup_never_ready(fake_process, fake_executor, mock_load):

def test_warmup_never_network(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="almalinux-base-v3", setup=True
compatibility_tag="almalinux-base-v4", setup=True
)
alias = almalinux.AlmaLinuxBaseAlias.NINE
base_config = almalinux.AlmaLinuxBase(
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/bases/test_centos_7.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
def mock_load(mocker):
return mocker.patch(
"craft_providers.instance_config.InstanceConfiguration.load",
return_value=InstanceConfiguration(compatibility_tag="centos-base-v3"),
return_value=InstanceConfiguration(compatibility_tag="centos-base-v4"),
)


Expand Down Expand Up @@ -150,7 +150,7 @@ def mock_get_os_release(mocker):
],
)
@pytest.mark.parametrize(
("tag", "expected_tag"), [(None, "centos-base-v3"), ("test-tag", "test-tag")]
("tag", "expected_tag"), [(None, "centos-base-v4"), ("test-tag", "test-tag")]
)
def test_setup(
fake_process,
Expand Down Expand Up @@ -603,7 +603,7 @@ def test_ensure_image_version_compatible_failure(fake_executor, monkeypatch):
base_config._ensure_instance_config_compatible(executor=fake_executor)

assert exc_info.value == BaseCompatibilityError(
"Expected image compatibility tag 'centos-base-v3', found 'invalid-tag'"
"Expected image compatibility tag 'centos-base-v4', found 'invalid-tag'"
)


Expand Down Expand Up @@ -1003,7 +1003,7 @@ def test_update_setup_status(fake_executor, mock_load, status):
assert fake_executor.records_of_push_file_io == [
{
"content": (
"compatibility_tag: centos-base-v3\n"
"compatibility_tag: centos-base-v4\n"
f"setup: {str(status).lower()}\n".encode()
),
"destination": "/etc/craft-instance.conf",
Expand Down Expand Up @@ -1112,7 +1112,7 @@ def test_warmup_overall(
environment, fake_process, fake_executor, mock_load, mocker, cache_path
):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="centos-base-v3", setup=True
compatibility_tag="centos-base-v4", setup=True
)
alias = centos.CentOSBaseAlias.SEVEN

Expand Down Expand Up @@ -1164,7 +1164,7 @@ def test_warmup_overall(

def test_warmup_bad_os(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="centos-base-v3", setup=True
compatibility_tag="centos-base-v4", setup=True
)
base_config = centos.CentOSBase(
alias=centos.CentOSBaseAlias.SEVEN,
Expand All @@ -1189,7 +1189,7 @@ def test_warmup_bad_os(fake_process, fake_executor, mock_load):

def test_warmup_bad_instance_config(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="centos-base-v3", setup=True
compatibility_tag="centos-base-v4", setup=True
)
alias = centos.CentOSBaseAlias.SEVEN
base_config = centos.CentOSBase(
Expand Down Expand Up @@ -1218,7 +1218,7 @@ def test_warmup_bad_instance_config(fake_process, fake_executor, mock_load):
def test_warmup_not_setup(setup, fake_process, fake_executor, mock_load):
"""Raise a BaseConfigurationError if the instance is not setup."""
mock_load.return_value = InstanceConfiguration(
compatibility_tag="centos-base-v3", setup=setup
compatibility_tag="centos-base-v4", setup=setup
)
alias = centos.CentOSBaseAlias.SEVEN
base_config = centos.CentOSBase(
Expand Down Expand Up @@ -1246,7 +1246,7 @@ def test_warmup_not_setup(setup, fake_process, fake_executor, mock_load):

def test_warmup_never_ready(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="centos-base-v3", setup=True
compatibility_tag="centos-base-v4", setup=True
)
alias = centos.CentOSBaseAlias.SEVEN
base_config = centos.CentOSBase(
Expand Down Expand Up @@ -1279,7 +1279,7 @@ def test_warmup_never_ready(fake_process, fake_executor, mock_load):

def test_warmup_never_network(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="centos-base-v3", setup=True
compatibility_tag="centos-base-v4", setup=True
)
alias = centos.CentOSBaseAlias.SEVEN
base_config = centos.CentOSBase(
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/bases/test_ubuntu_buildd.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
def mock_load(mocker):
return mocker.patch(
"craft_providers.instance_config.InstanceConfiguration.load",
return_value=InstanceConfiguration(compatibility_tag="buildd-base-v3"),
return_value=InstanceConfiguration(compatibility_tag="buildd-base-v4"),
)


Expand Down Expand Up @@ -146,7 +146,7 @@ def mock_get_os_release(mocker):
],
)
@pytest.mark.parametrize(
("tag", "expected_tag"), [(None, "buildd-base-v3"), ("test-tag", "test-tag")]
("tag", "expected_tag"), [(None, "buildd-base-v4"), ("test-tag", "test-tag")]
)
def test_setup(
fake_process,
Expand Down Expand Up @@ -682,7 +682,7 @@ def test_ensure_image_version_compatible_failure(fake_executor, monkeypatch):
base_config._ensure_instance_config_compatible(executor=fake_executor)

assert exc_info.value == BaseCompatibilityError(
"Expected image compatibility tag 'buildd-base-v3', found 'invalid-tag'"
"Expected image compatibility tag 'buildd-base-v4', found 'invalid-tag'"
)


Expand Down Expand Up @@ -1437,7 +1437,7 @@ def test_update_setup_status(fake_executor, mock_load, status):
assert fake_executor.records_of_push_file_io == [
{
"content": (
"compatibility_tag: buildd-base-v3\n"
"compatibility_tag: buildd-base-v4\n"
f"setup: {str(status).lower()}\n".encode()
),
"destination": "/etc/craft-instance.conf",
Expand Down Expand Up @@ -1546,7 +1546,7 @@ def test_warmup_overall(
environment, fake_process, fake_executor, mock_load, mocker, cache_path
):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="buildd-base-v3", setup=True
compatibility_tag="buildd-base-v4", setup=True
)

alias = ubuntu.BuilddBaseAlias.JAMMY
Expand Down Expand Up @@ -1595,7 +1595,7 @@ def test_warmup_overall(

def test_warmup_bad_os(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="buildd-base-v3", setup=True
compatibility_tag="buildd-base-v4", setup=True
)
base_config = ubuntu.BuilddBase(
alias=ubuntu.BuilddBaseAlias.JAMMY,
Expand All @@ -1620,7 +1620,7 @@ def test_warmup_bad_os(fake_process, fake_executor, mock_load):

def test_warmup_bad_instance_config(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="buildd-base-v3", setup=True
compatibility_tag="buildd-base-v4", setup=True
)
alias = ubuntu.BuilddBaseAlias.JAMMY
base_config = ubuntu.BuilddBase(
Expand Down Expand Up @@ -1649,7 +1649,7 @@ def test_warmup_bad_instance_config(fake_process, fake_executor, mock_load):
def test_warmup_not_setup(setup, fake_process, fake_executor, mock_load):
"""Raise a BaseConfigurationError if the instance is not setup."""
mock_load.return_value = InstanceConfiguration(
compatibility_tag="buildd-base-v3", setup=setup
compatibility_tag="buildd-base-v4", setup=setup
)
alias = ubuntu.BuilddBaseAlias.JAMMY
base_config = ubuntu.BuilddBase(
Expand Down Expand Up @@ -1677,7 +1677,7 @@ def test_warmup_not_setup(setup, fake_process, fake_executor, mock_load):

def test_warmup_never_ready(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="buildd-base-v3", setup=True
compatibility_tag="buildd-base-v4", setup=True
)
alias = ubuntu.BuilddBaseAlias.JAMMY
base_config = ubuntu.BuilddBase(
Expand Down Expand Up @@ -1709,7 +1709,7 @@ def test_warmup_never_ready(fake_process, fake_executor, mock_load):

def test_warmup_never_network(fake_process, fake_executor, mock_load):
mock_load.return_value = InstanceConfiguration(
compatibility_tag="buildd-base-v3", setup=True
compatibility_tag="buildd-base-v4", setup=True
)
alias = ubuntu.BuilddBaseAlias.JAMMY
base_config = ubuntu.BuilddBase(
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ def test_mount_shared_cache_dirs(fake_process, fake_base, fake_executor, cache_d
expected = {
"host_source": pathlib.WindowsPath("d:")
/ cache_dir
/ "base-v3"
/ "base-v4"
/ "FakeBaseAlias.TREBLE"
/ "pip",
"target": user_cache_dir / "pip",
}
else:
expected = {
"host_source": cache_dir / "base-v3" / "FakeBaseAlias.TREBLE" / "pip",
"host_source": cache_dir / "base-v4" / "FakeBaseAlias.TREBLE" / "pip",
"target": user_cache_dir / "pip",
}
assert fake_executor.records_of_mount == [expected]
Expand Down

0 comments on commit 029c322

Please sign in to comment.