From 41862ef3d3a8a71f7e3614313b15d06283433d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 1 Jul 2025 13:05:07 +0200 Subject: [PATCH 1/2] vars: make debug logging less verbose --- pkgs/clan-cli/clan_cli/vars/check.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/vars/check.py b/pkgs/clan-cli/clan_cli/vars/check.py index d024f854a..e7087f73d 100644 --- a/pkgs/clan-cli/clan_cli/vars/check.py +++ b/pkgs/clan-cli/clan_cli/vars/check.py @@ -84,10 +84,6 @@ def vars_status(machine: Machine, generator_name: None | str = None) -> VarStatu machine.info( f"Generator '{generator.name}' in machine {machine.name} has outdated invalidation hash." ) - machine.debug(f"missing_secret_vars: {missing_secret_vars}") - machine.debug(f"missing_public_vars: {missing_public_vars}") - machine.debug(f"unfixed_secret_vars: {unfixed_secret_vars}") - machine.debug(f"invalid_generators: {invalid_generators}") return VarStatus( missing_secret_vars, missing_public_vars, From d434731c22f1afbc75fed39ceee9c8ca6bb858f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 1 Jul 2025 15:03:40 +0200 Subject: [PATCH 2/2] clan_lib/test_create: fix test when running outside of the sandbox... --- pkgs/clan-cli/clan_lib/tests/test_create.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/tests/test_create.py b/pkgs/clan-cli/clan_lib/tests/test_create.py index 40e476912..29b460a19 100644 --- a/pkgs/clan-cli/clan_lib/tests/test_create.py +++ b/pkgs/clan-cli/clan_lib/tests/test_create.py @@ -1,5 +1,6 @@ import json import logging +import os import shutil import sys from dataclasses import dataclass @@ -271,7 +272,19 @@ def test_clan_create_api( set_machine_disk_schema(machine, "single-disk", placeholders) clan_dir_flake.invalidate_cache() - # ATTENTION: This raises only in the CI / Build sandbox executing this locally without the sandbox wouldn't raise! - with pytest.raises(ClanError) as exc_info: - Path(machine.select("config.system.build.toplevel")) - assert "nixos-system-test-clan" in str(exc_info.value) + # In the sandbox, building fails due to network restrictions (can't download dependencies) + # Outside the sandbox, the build should succeed + in_sandbox = os.environ.get("IN_NIX_SANDBOX") == "1" + + if in_sandbox: + # In sandbox: expect build to fail due to network restrictions + with pytest.raises(ClanError) as exc_info: + Path(machine.select("config.system.build.toplevel")) + # The error should mention the system derivation name + assert "nixos-system-test-clan" in str(exc_info.value) + else: + # Outside sandbox: build should succeed + toplevel_path = Path(machine.select("config.system.build.toplevel")) + assert toplevel_path.exists() + # Verify it's a NixOS system by checking for expected content + assert "nixos-system-test-clan" in str(toplevel_path)