From 26587ff769c75c39b6457165bd3b512e98a1793d Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 31 Oct 2025 01:58:57 +0100 Subject: [PATCH 1/2] Set the libvirt management domain This makes sure the domain is set when the management domain is created, which makes libvirt configure dnsmasq as a proper DNS server. This can be used together with systemd-resolved on the host to look up guest IPs. It also configures Vagrant in CI with DNS set up to utilize this. --- .github/workflows/test.yml | 2 ++ Vagrantfile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 02f2aa38..04acecc0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,8 @@ jobs: python-version: '3.12' - name: Setup libvirt for Vagrant uses: voxpupuli/setup-vagrant@v0 + with: + configure_dns: true - name: Install Ansible run: pip install --upgrade ansible-core - name: Setup environment diff --git a/Vagrantfile b/Vagrantfile index d89ea60f..4e6347bf 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -14,6 +14,7 @@ Vagrant.configure("2") do |config| libvirt.memory = 10240 libvirt.cpus = 4 libvirt.machine_virtual_size = 30 + libvirt.management_network_domain = 'example.com' end override.vm.provision('disk_resize', type: 'ansible') do |ansible_provisioner| @@ -26,6 +27,7 @@ Vagrant.configure("2") do |config| override.vm.provider "libvirt" do |libvirt, provider| libvirt.memory = 1024 + libvirt.management_network_domain = 'example.com' end end end From c4c840ff9ddb4888e24b147794e2e2cd8d92d679 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 28 Oct 2025 18:51:38 +0100 Subject: [PATCH 2/2] Rely on smoker for the content tests --- development/playbooks/smoker/smoker.yaml | 2 + tests/foreman_api_test.py | 56 ------------------------ 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/development/playbooks/smoker/smoker.yaml b/development/playbooks/smoker/smoker.yaml index 59c32f6b..61eb11e0 100644 --- a/development/playbooks/smoker/smoker.yaml +++ b/development/playbooks/smoker/smoker.yaml @@ -6,6 +6,8 @@ - ../../../src/vars/foreman.yml - "{{ obsah_state_path }}/parameters.yaml" # this is a hack to load persisted params without enabling persisting vars: + smoker_url: https://github.com/ekohl/smoker + smoker_version: add-content-api-tests smoker_base_url: "https://{{ hostvars['quadlet'].ansible_default_ipv4.address }}" smoker_variables: username: "{{ foreman_initial_admin_username }}" diff --git a/tests/foreman_api_test.py b/tests/foreman_api_test.py index 101fe7e9..e2178491 100644 --- a/tests/foreman_api_test.py +++ b/tests/foreman_api_test.py @@ -1,58 +1,2 @@ -import urllib.parse - -import requests - - -def _repo_url(repo, ssh_config): - return urllib.parse.urlunparse(urllib.parse.urlparse(repo['full_path'])._replace(netloc=ssh_config['hostname'])) - - def test_foreman_organization(organization): assert organization - -def test_foreman_product(product): - assert product - -def test_foreman_yum_repository(yum_repository, foremanapi, ssh_config): - assert yum_repository - foremanapi.resource_action('repositories', 'sync', {'id': yum_repository['id']}) - repo_url = _repo_url(yum_repository, ssh_config) - assert requests.get(f'{repo_url}/repodata/repomd.xml', verify=False) - assert requests.get(f'{repo_url}/Packages/b/bear-4.1-1.noarch.rpm', verify=False) - - -def test_foreman_file_repository(file_repository, foremanapi, ssh_config): - assert file_repository - foremanapi.resource_action('repositories', 'sync', {'id': file_repository['id']}) - repo_url = _repo_url(file_repository, ssh_config) - assert requests.get(f'{repo_url}/1.iso', verify=False) - - -def test_foreman_container_repository(container_repository, foremanapi, ssh_config): - assert container_repository - foremanapi.resource_action('repositories', 'sync', {'id': container_repository['id']}) - - -def test_foreman_lifecycle_environment(lifecycle_environment): - assert lifecycle_environment - - -def test_foreman_content_view(content_view, yum_repository, foremanapi): - assert content_view - foremanapi.update('content_views', {'id': content_view['id'], 'repository_ids': [yum_repository['id']]}) - foremanapi.resource_action('content_views', 'publish', {'id': content_view['id']}) - # do something with the published view - versions = foremanapi.list('content_view_versions', params={'content_view_id': content_view['id']}) - for version in versions: - current_environment_ids = {environment['id'] for environment in version['environments']} - for environment_id in current_environment_ids: - foremanapi.resource_action('content_views', 'remove_from_environment', params={'id': content_view['id'], 'environment_id': environment_id}) - foremanapi.delete('content_view_versions', version) - - -def test_foreman_manifest(organization, foremanapi, fixture_dir): - manifest_path = fixture_dir / 'manifest.zip' - with open(manifest_path, 'rb') as manifest_file: - files = {'content': (str(manifest_path), manifest_file, 'application/zip')} - params = {'organization_id': organization['id']} - foremanapi.resource_action('subscriptions', 'upload', params, files=files)