Skip to content

Commit

Permalink
fixes for nixos 24.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ctheune committed Dec 19, 2024
1 parent ce55fc8 commit 50aace5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
10 changes: 4 additions & 6 deletions src/fc/qemu/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import datetime
import distutils.spawn
import fcntl
import glob
import importlib.resources
import json
import math
import os
import os.path as p
import shutil
import socket
import subprocess
Expand All @@ -21,7 +20,6 @@
import colorama
import consulate
import consulate.models.agent
import pkg_resources
import requests
import yaml

Expand Down Expand Up @@ -272,9 +270,9 @@ class Agent(object):
timeout_graceful = 10

system_config_template = Path("etc/qemu/qemu.vm.cfg.in")
builtin_config_template = Path(
pkg_resources.resource_filename(__name__, "qemu.vm.cfg.in")
)
# XXX the importlib schema requiring a context manager
# is not helpful here.
builtin_config_template = Path(__file__).parent / "qemu.vm.cfg.in"
consul_token = None
consul_generation = -1

Expand Down
5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import traceback
from pathlib import Path

import pkg_resources
import pytest
import structlog

Expand Down Expand Up @@ -224,8 +223,8 @@ def vm(clean_environment, monkeypatch, tmpdir):
import fc.qemu.hazmat.qemu

monkeypatch.setattr(fc.qemu.hazmat.qemu.Qemu, "guestagent_timeout", 0.1)
fixtures = pkg_resources.resource_filename(__name__, "fixtures")
shutil.copy(fixtures + "/simplevm.yaml", "/etc/qemu/vm/simplevm.cfg")
simplevm_cfg = Path(__file__).parent / "fixtures" / "simplevm.yaml"
shutil.copy(simplevm_cfg, "/etc/qemu/vm/simplevm.cfg")
Path("/etc/qemu/vm/.simplevm.cfg.staging").unlink(missing_ok=True)

vm = Agent("simplevm")
Expand Down
6 changes: 3 additions & 3 deletions tests/hazmat/test_ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_multiple_images_raises_error(ceph_inst):
@pytest.mark.timeout(60)
@pytest.mark.live()
def test_rbd_pool_migration(ceph_inst, patterns) -> None:
ceph_inst.cfg["tmp_size"] = 50 * 1024 * 1024
ceph_inst.cfg["tmp_size"] = 500 * 1024 * 1024
ceph_inst.cfg["swap_size"] = 50 * 1024 * 1024
ceph_inst.cfg["root_size"] = 50 * 1024 * 1024
rbd.RBD().create(
Expand Down Expand Up @@ -83,6 +83,8 @@ def test_rbd_pool_migration(ceph_inst, patterns) -> None:
first_start.optional(
"""
waiting interval=0 machine=simplevm remaining=4 subsystem=ceph volume=rbd.hdd/simplevm.tmp
sgdisk> Setting name!
sgdisk> partNum is 0
"""
)
first_start.in_order(
Expand Down Expand Up @@ -138,8 +140,6 @@ def test_rbd_pool_migration(ceph_inst, patterns) -> None:
sgdisk> The operation has completed successfully.
sgdisk machine=simplevm returncode=0 subsystem=ceph volume=rbd.hdd/simplevm.tmp
sgdisk args=-a 8192 -n 1:8192:0 -c "1:tmp" -t 1:8300 "/dev/rbd/rbd.hdd/simplevm.tmp" machine=simplevm subsystem=ceph volume=rbd.hdd/simplevm.tmp
sgdisk> Setting name!
sgdisk> partNum is 0
sgdisk> The operation has completed successfully.
sgdisk machine=simplevm returncode=0 subsystem=ceph volume=rbd.hdd/simplevm.tmp
partprobe args=/dev/rbd/rbd.hdd/simplevm.tmp machine=simplevm subsystem=ceph volume=rbd.hdd/simplevm.tmp
Expand Down
2 changes: 1 addition & 1 deletion tests/hazmat/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_volume_mkswap(ceph_inst):

@pytest.mark.timeout(60)
def test_volume_tmp_mkfs(tmp_spec):
tmp_spec.desired_size = 100 * 1024 * 1024
tmp_spec.desired_size = 400 * 1024 * 1024
tmp_spec.ensure_presence()
with tmp_spec.volume.mapped():
tmp_spec.mkfs()
Expand Down
4 changes: 1 addition & 3 deletions tests/test_agent.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os
import shutil
from pathlib import Path

import mock
import pkg_resources
import psutil
import pytest

Expand All @@ -14,7 +12,7 @@

@pytest.fixture
def simplevm_cfg(monkeypatch):
fixtures = Path(pkg_resources.resource_filename(__name__, "fixtures"))
fixtures = Path(__file__).parent / "fixtures"
source = fixtures / "simplevm.yaml"
# The Qemu prefix gets adjusted automatically in the synhetic_root
# auto-use fixture that checks whether this is a live test or not.
Expand Down
1 change: 1 addition & 0 deletions tests/test_binenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ def test_no_unexpected_binaries():
@pytest.mark.unit
def test_ensure_critical_module_imports():
import rados # noqa
import structlog # noqa

0 comments on commit 50aace5

Please sign in to comment.