Hi Ludo, thanks for your review. Here is a v2, I hope I addressed your previous comments with it, but I need some help. As you suggested I also added some tests. Some use mocking, and some run against the Hetzner API, if the GUIX_HETZNER_API_TOKEN env var is set. ./pre-inst-env make check TESTS="tests/machine/hetzner/http.scm" ./pre-inst-env make check TESTS="tests/machine/hetzner.scm" All tests pass when I run them in the Geiser REPL, where I developed them. But I have some trouble with one test that uses mocking. The "deploy-machine-mock-with-unprovisioned-server" test in tests/machine/hetzner.scm only fails when run in the terminal. :? I'm using the "mock" function from (guix tests) to mock some HTTP and SSH calls. The issue is that I see different behaviour whether I run the tests in Geiser vs in the Terminal. In Geiser I see the following output for this test, in it passes: ------------------------------------------------------------------------------- creating 'cx42' server for 'guix-x86'... successfully created 'cx42' x86 server for 'guix-x86' enabling rescue system on 'guix-x86'... MOCK ENABLE RESUCE successfully enabled rescue system on 'guix-x86' powering on server for 'guix-x86'... MOCK POWER ON successfully powered on server for 'guix-x86' connecting via SSH to '1.2.3.4' using '/tmp/guix-hetzner-machine-test-key'... MOCK OPEN SSH SESSION installing rescue system packages on 'guix-x86'... MOCK RUNNING SCRIPT: /tmp/guix/deploy/hetzner-machine-rescue-install-packages successfully installed rescue system packages on 'guix-x86' setting up partitions on 'guix-x86'... MOCK RUNNING SCRIPT: /tmp/guix/deploy/hetzner-machine-rescue-partition successfully setup partitions on 'guix-x86' installing guix operating system on 'guix-x86'... MOCK RUNNING SCRIPT: /tmp/guix/deploy/hetzner-machine-rescue-install-os successfully installed guix operating system on 'guix-x86' rebooting server for 'guix-x86'... successfully rebooted server for 'guix-x86' connecting via SSH to '1.2.3.4' using '/tmp/guix-hetzner-machine-test-key'... MOCK OPEN SSH SESSION ------------------------------------------------------------------------------- You can see that calls to "hetzner-machine-ssh-run-script" are mocked, because "MOCK RUNNING SCRIPT" is printed multiple times. But in a "guix shell -D" terminal I see the following output for the test, and it is failing: ------------------------------------------------------------------------------- creating 'cx42' server for 'guix-x86'... successfully created 'cx42' x86 server for 'guix-x86' enabling rescue system on 'guix-x86'... MOCK ENABLE RESUCE successfully enabled rescue system on 'guix-x86' powering on server for 'guix-x86'... MOCK POWER ON successfully powered on server for 'guix-x86' connecting via SSH to '1.2.3.4' using '/tmp/guix-hetzner-machine-test-key'... MOCK OPEN SSH SESSION installing rescue system packages on 'guix-x86'... test-name: deploy-machine-mock-with-unprovisioned-server location: /home/roman/workspace/guix/tests/machine/hetzner.scm:189 actual-value: #f actual-error: + (guile-ssh-error + "%gssh-make-sftp-session" + "Could not create a SFTP session" + #@1.2.3.4:22 (disconnected) ffff85596de0> + #f) result: FAIL ;;; [2025/01/19 17:39:16.791023, 0] [GSSH ERROR] Could not create a SFTP session: #@1.2.3.4:22 (disconnected) ffff85596de0> ------------------------------------------------------------------------------- The tests fails here trying to use a disconnected SSH session object, that I returned in a mocked call. This code should actually never be reached, because I mock the "hetzner-machine-ssh-run-script" call. But for some reason the mock is not working here. The "MOCK RUNNING SCRIPT" output is missing. Do you have any ideas what could be going on here? I suspect this might be due to some optimization or env issue, but I'm pretty lost. I attached a WIP v2 for now. Will send a v3 and a separate patch for the ssh modification once I fixed this mock test. Thanks, Roman.