summaryrefslogtreecommitdiff
path: root/tests/machine
AgeCommit message (Collapse)AuthorFilesLines
2026-06-18tests: Use ‘match’ when mocking a Hetzner HTTP server.Ludovic Courtès1-89/+83
Using ‘match’ to check requests is more conventional and more concise. It also avoids relying on Guile-Lib, which is an optional dependency, for its ‘assert’ macro. * tests/machine/hetzner/http.scm ("hetzner-api-actions-unit") ("hetzner-api-locations-unit") ("hetzner-api-server-types-unit") ("hetzner-api-server-delete-unit") ("hetzner-api-server-enable-rescue-system-unit") ("hetzner-api-server-power-on-unit") ("hetzner-api-server-power-off-unit") ("hetzner-api-server-reboot-unit") ("hetzner-api-ssh-key-create-unit") ("hetzner-api-ssh-key-delete-unit") ("hetzner-api-ssh-keys-unit") ("hetzner-api-primary-ips-unit"): Use ‘match’ instead of ‘cond’ and ‘assert’. Change-Id: Idf8cb1c11b332ffe780ed83c624dc50484b0db52 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2026-06-18tests: Adjust Hetzner test for the new use of ‘hetzner-api-images’.Ludovic Courtès1-15/+20
Fixes a regression introduced in f98c00ab749e6b82e56a4a34d0789496451cbc59. * tests/machine/hetzner/http.scm ("hetzner-api-server-create-unit"): Rewrite using ‘match’ and add clause for /v1/images. Change-Id: Ib87ebb48c6765b5228a24092a974bd76605a7288 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2026-05-23machine: hetzner: Fix initial deploy when ssh-key is #f.Maxim Cournoyer2-7/+12
This fixes a regression introduced in commit a2ef2bcbfd7 ("machine: hetzner: Allow connections using ssh-agent"), where having no ssh-key would cause the early Hetzner provisioning to fail due to the lack of SSH authentication. * gnu/machine/hetzner.scm (%hetzner-ssh-key-file): New parameter. (<hetzner-configuration>) [ssh-public-key]: Compute default according to the value of the private ssh-key field. Introduce an indirection via... (hetzner-configuration-ssh-public-key): ... this new procedure, to honor %hetzner-ssh-key-file. (hetzner-configuration-ssh-key): Likewise for the private ssh-key. (hetzner-configuration-ssh-key-fingerprint): Rename to... (public-key->fingerprint): ... this, taking just the public key as argument. Update doc. (hetzner-configuration-ssh-key-public): Rename to... (public-key->string-with-type): ...this, for clarity, and accept just a public-key object. Update doc. (hetzner-machine-ssh-key): Exit early with #f when no ssh key is provided. (temporary-ssh-key-file): New procedure. (hetzner-machine-ssh-key-create): Assert a public key is defined. Adjust calls to renamed procedures, and adjust for the `hetzner-api-server-create' API change. (hetzner-machine-enable-rescue-system): Refine doc and fix code path when ssh-key is #f. (hetzner-machine-rescue-install-os): Document. (hetzner-machine-provision): Refine doc. Remove extraneous sleep and #:unwind argument. Limit ssh-session dynamic scope to where it's needed. (cleanup-temporary-ssh-key/maybe): New procedure. (deploy-hetzner): Create and use a temporary SSH key when none is defined, and clean it up when done or on errors. * gnu/machine/hetzner/http.scm (hetzner-api-server-create): Make ssh-keys a keyword argument, and fix execution when it's #f. (hetzner-api-server-enable-rescue-system): Likewise. * tests/machine/hetzner.scm ("deploy-machine-mock-with-unprovisioned-server"): Adjust test. * tests/machine/hetzner/http.scm (create-server) ("hetzner-api-server-create-unit") ("hetzner-api-server-enable-rescue-system-unit") ("hetzner-api-actions-integration") ("hetzner-api-server-enable-rescue-system-integration"): Likewise. * doc/guix.texi (Invoking guix deploy): Precise what happens when 'ssh-key' is #f in hetzner-configuration, and suggest declaratively authorizing your SSH key. Change-Id: I812b348fb553f3b5aebd0bf66850c6ecb9e06653
2025-04-21machine: hetzner: Allow attaching existing public IPs.Sergey Trofimov1-0/+38
* gnu/machine/hetzner.scm (hetzner-configuration): Add ipv4 and ipv6 fields. Export accessors. * gnu/machine/hetzner/http.scm (hetnzer-api-primary-ips): New function. (<hetzner-primary-ip>): New json mapping. (hetzner-api-server-create): Pass IP addresses in request. * doc/guix.texi (Invoking guix deploy): Document it. Change-Id: I44509cc98e041762dc483e876566e79bde85b26a Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-02-28machine: hetzner: Fix deployment on smaller instances.Roman Scherer1-2/+2
* gnu/machine/hetzner.scm (hetzner-machine-rescue-install-os): Avoid out of disk space error by bind mounting /mnt/tmp/gnu/store to /gnu/store. * tests/machine/hetzner.scm: Test with smaller instances. * doc/guix.texi (Invoking guix deploy): Mention unsupported instance. Change-Id: If8bfb6733de493b51813b3e82e255849192f7cba Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-02-09machine: Implement 'hetzner-environment-type'.Roman Scherer2-0/+898
* Makefile.am (SCM_TESTS): Add test modules. * doc/guix.texi: Add documentation. * gnu/local.mk (GNU_SYSTEM_MODULES): Add modules. * gnu/machine/hetzner.scm: Add hetzner-environment-type. * gnu/machine/hetzner/http.scm: Add HTTP API. * po/guix/POTFILES.in: Add Hetzner modules. * tests/machine/hetzner.scm: Add machine tests. * tests/machine/hetzner/http.scm Add HTTP API tests. Change-Id: I276ed5afed676bbccc6c852c56ee4db57ce3c1ea Signed-off-by: Ludovic Courtès <ludo@gnu.org>