Commit Graph

52 Commits

Author SHA1 Message Date
Jörg Thalheim
c5e30a40b4 pytests: use /tmp on macos to avoid unix socket issues 2025-03-19 18:35:38 +01:00
Jörg Thalheim
9a00459861 tests/fixtures_flakes: remove unused remote flag 2025-03-19 16:55:30 +01:00
Jörg Thalheim
43035b85a5 always resolve symlinks for TemporaryDirectory
On macOS mktemp returns a temporary directory in a symlink.
Nix has a bug where it won't accept path:// located in a symlink.
This avoid this issue by always resolving symlinks as returned by
TemporaryDirectory.
2025-03-19 16:47:18 +01:00
Louis Opter
546ed03a90 clan-cli: tests: call SopsSetup.init while setting up fixtures
We do this by introducing `flake_with_sops` fixture, that calls the
init method ahead of the test. We did not want to do this in the `flake`
fixture since not all tests using the `flake` fixture need to have sops
setup.
2025-03-19 10:53:38 +00:00
lassulus
300aaa48e7 clan-cli: use new flake caching for machines 2025-02-23 15:58:03 +01:00
Johannes Kirschbauer
ffff5aa5ae CLI/tests: use correct fixture paths 2024-11-28 11:56:12 +01:00
DavHau
44e6fe803f vars: make all python tests work in nix sandbox
- generate a flake.lock file for each template by copying the clan-core flake.lock and modifying it

- call nix build with --store for tests inside the sandbox
2024-11-27 14:32:02 +07:00
DavHau
1d66d32163 tests: improve performance, keep flake.lock between tests
- deprecate fixture generate_flake in favor of class ClanFlake
- allow creating flake templates that can be copied, including their state, like git and lock files, in order to avoid expensive re-initialization
2024-11-18 17:01:58 +07:00
Qubasa
26730cd662 clan-cli: upload.py -> Replace rsync with native ssh command 2024-11-15 22:03:47 +07:00
a-kenji
edef77091a pkgs/cli: Fix typo in test fixtures 2024-11-14 15:00:44 +01:00
DavHau
05ff6cfd89 cleanup: remove legacy flake fixture test_flake_minimal and test_flake_with_core_and_pass 2024-11-14 14:03:29 +07:00
Jörg Thalheim
4af1954abf ruff: enable warning lints 2024-10-23 09:06:02 +00:00
Jörg Thalheim
c620ee9d90 fixtures_flake: drop unused substitutions 2024-10-09 12:07:58 +02:00
Jörg Thalheim
4655199028 tests: set git author name + email via environment variables 2024-10-09 12:07:58 +02:00
Jörg Thalheim
0e8f168e1e no longer write deprecated settings.json in tests 2024-10-09 12:02:10 +02:00
DavHau
11c37ebeba vars/keygen: fix + cleanup tests
- generate keys in ./sops instead of ./sops/vars for now
- don't initialize all flakes with sops keys, only generate when needed
- use the new 'clan vars keygen' in tests
2024-10-04 17:25:17 +02:00
Jörg Thalheim
f9a42831e4 start to name temporary directories in more places 2024-10-01 18:57:59 +02:00
DavHau
e49d1f0127 vars/sops: improve shared secrets, switching backend
When a second machine checks for a shared secret, now the exists() call returns negative and only when updating the secrets for that machine, the machine is added to the sops receivers.

Also throw proper errors when the user switches backends without cleaning the files first.
2024-09-20 15:06:54 +02:00
Qubasa
2568002611 clan-cli: Make run_vm_in_thread fail fast. Fix generate_flake to support machine_id 2024-09-06 18:53:02 +02:00
Jörg Thalheim
29909e49d3 apply TRY lint 2024-09-03 18:13:46 +02:00
Jörg Thalheim
dca1bd084d add PT 2024-09-02 15:52:17 +02:00
Jörg Thalheim
e150b37fb8 enable ASYNC, DTZ, YTT and EM lints 2024-09-02 14:07:06 +02:00
Jörg Thalheim
109d1faf9e enable bug-bear linting rules 2024-09-02 13:26:07 +02:00
Jörg Thalheim
bc1c7c748f try to log content of flake substitutes 2024-08-15 17:43:57 +02:00
Jörg Thalheim
dc229a1b3b fixtures_flake: avoid fileinput
it seems that the inplace argument in some cases picks up output from
unrelated functions. Since the file is relativly small, we can just
replace the content in one go.
2024-08-14 16:56:44 +02:00
DavHau
2bc716377d tests/generate_flake: support inventory argument 2024-07-24 17:06:42 +07:00
Johannes Kirschbauer
ad70ee72e5 Unit tests: fix template test - override the input in the flake template 2024-07-17 12:06:23 +02:00
DavHau
bb1950a4a0 fixtures_flakes.py: remove dead code 2024-07-05 15:55:52 +07:00
DavHau
4db2e8303f refactor: rename clanCore -> clan.core 2024-06-18 18:32:40 +07:00
DavHau
8eafd43fd3 tests: add test for creating machine on minimal clan 2024-06-09 21:54:04 -07:00
DavHau
e09658c817 secrets: ensure all added/deleted files get committed 2024-04-24 17:26:32 +07:00
DavHau
a438a27c69 vms: init graceful shutdown for GUI
- add python modules for qemu protocols: QMP (hardware interactions) and QGA (guest service interaction)
- refactor state directory: remove name from path (already contains url)
- add impure vm test for basic qmp interaction
- simplify existing vm persistance test (factor out shared code)
- integrate graceful shutdown into GUI

the GUI integration still needs to be improved later:
- add fallback in case system doesn't react to powerdown button
- shutdown GUI switch fails if VM hasn't been started yet, and then remains in a wrong position
2024-02-09 19:55:18 +07:00
DavHau
5cdd9a1817 VMs: port vm_persistence test to python 2024-01-09 14:47:33 +07:00
Qubasa
999747c5fc Deleted everything webui 2023-12-14 18:47:14 +01:00
Qubasa
4506202a82 Added clan flakes inspect command. Improved ClanURI. Added democlan as dependency in flake.nix 2023-12-09 00:09:21 +01:00
Jörg Thalheim
6f0722c692 modernisation for python 3.11 2023-11-29 13:29:45 +00:00
lassulus
082d628497 clan_cli: flake_name -> flake_dir 2023-11-15 16:23:28 +01:00
Jörg Thalheim
48d7968cf9 move flake configuration to .config/clan/flakes rather than $XDG_DATA_DIRS 2023-11-10 12:50:51 +01:00
Jörg Thalheim
5d972ed4a4 clan: use .local/share as default for XDG_DATA_HOME 2023-11-09 17:45:24 +01:00
Qubasa
a00056824d API: Added /api/flake/list. Added API grouping and description for better visibility 2023-11-03 22:05:33 +01:00
Qubasa
a628934351 Removing find_git_repo 2023-10-27 19:26:03 +02:00
Qubasa
8e8b6530b0 Fixing test_vms_api test 2023-10-27 19:26:03 +02:00
Qubasa
750b4b6b7e Fixing test_vms_api test 2023-10-27 19:26:03 +02:00
Qubasa
916fa8e570 All tests passing babyyy !! 2023-10-27 19:26:03 +02:00
Qubasa
0be3dac289 nix fmt 2023-10-27 19:21:50 +02:00
Qubasa
8ff80b025c Fixing a multitude of tests 2023-10-27 19:21:50 +02:00
Qubasa
950808498f Working test_create_flake 2023-10-27 19:20:17 +02:00
Qubasa
d96ea61243 Secrets tests passing. nix fmt doesn't complain 2023-10-27 19:18:45 +02:00
Qubasa
7bbadaa60f Fixed cyclic dependencie AND swapped pytest-parallel for pytest-xdist to fix deadlock in tests 2023-10-27 19:18:45 +02:00
Qubasa
ecdd4949b7 Added new type FlakeName 2023-10-27 19:18:45 +02:00