Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that apt interprets our .sources files correctly #1093

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions tests/test_vms_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import subprocess
import unittest

from base import CURRENT_FEDORA_TEMPLATE, SD_VMS
from base import (
CURRENT_FEDORA_TEMPLATE,
CURRENT_WHONIX_VERSION,
SD_TEMPLATE_LARGE,
SD_TEMPLATE_SMALL,
SD_VMS,
)
from qubesadmin import Qubes

BULLSEYE_STRING = "Debian GNU/Linux 11 (bullseye)"
Expand Down Expand Up @@ -180,21 +186,37 @@ def test_dispvm_default_platform(self):
result = subprocess.check_output(cmd).decode("utf-8").rstrip("\n")
self.assertEqual(result, "sd-viewer")

def test_all_sd_vm_apt_sources(self):
def test_sd_vm_apt_sources(self):
"""
Test all VMs fpf apt source list iteratively.

Due to for-loop implementation, the first failure will stop the test.
Therefore, even if multiple VMs are NOT running a supported platform,
only a single failure will be reported.
Test that the three templates we install our apt sources into are correct
"""
for vm_name in SD_VMS:
if vm_name == "sd-viewer":
# sd-viewer is unable to start because of the securedrop-mime-handling
# systemd service failing, so skip it here.
continue
for vm_name in [
SD_TEMPLATE_SMALL,
SD_TEMPLATE_LARGE,
f"whonix-gateway-{CURRENT_WHONIX_VERSION}",
]:
vm = self.app.domains[vm_name]
# First verify it looks like what we provisioned
self._validate_apt_sources(vm)
stdout, stderr = vm.run("apt-get indextargets")
contents = stdout.decode().strip()
self.assertIn(
"Description: https://apt.freedom.press bookworm/main amd64 Packages\n", contents
)
if self.config["environment"] == "prod":
# prod setups shouldn't have any apt-test sources
self.assertNotIn("apt-test.freedom.press", contents)
else:
# staging/dev
test_components = ["main"]
if self.config["environment"] == "dev":
test_components.append("nightlies")
for component in test_components:
self.assertIn(
f"Description: https://apt-test.freedom.press bookworm/{component} "
"amd64 Packages\n",
contents,
)


def load_tests(loader, tests, pattern):
Expand Down