-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from MatthewCroughan/mc/sshPort
makeDarwinImage: test sshPort is being set and used in nixosModule
- Loading branch information
Showing
3 changed files
with
10 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
nixosTest { | ||
name = "macos-ventura"; | ||
nodes = { | ||
machine = { ... }: { | ||
machine = { config, ... }: { | ||
virtualisation.memorySize = 6144; | ||
imports = [ nixosModule ]; | ||
environment.systemPackages = [ openssh sshpass ]; | ||
networking.firewall.allowedTCPPorts = [ 5900 2222 ]; | ||
networking.firewall.allowedTCPPorts = [ 5900 "${toString config.services.macos-ventura.sshPort}"]; | ||
networking.firewall.enable = false; | ||
services.macos-ventura = { | ||
enable = true; | ||
|
@@ -15,26 +15,27 @@ nixosTest { | |
mem = "4G"; | ||
vncListenAddr = "0.0.0.0"; | ||
extraQemuFlags = [ "-nographic" ]; | ||
sshPort = 2021; | ||
}; | ||
}; | ||
}; | ||
testScript = let | ||
testScript = { nodes, ... }: let | ||
sshProductVersion = writeShellScript "foo" '' | ||
# Wait until a successful ssh-keyscan | ||
while ! ssh-keyscan -p 2222 127.0.0.1; do | ||
while ! ssh-keyscan -p ${toString nodes.machine.config.services.macos-ventura.sshPort} 127.0.0.1; do | ||
sleep 3 | ||
echo "SSH not ready" >&2 | ||
done | ||
echo "SSH ready!" >&2 | ||
# Should return stdout like "ProductVersion: 13.6" | ||
sshpass -p admin ssh -o StrictHostKeyChecking=no -p 2222 [email protected] sw_vers | grep ProductVersion | awk '{print $2}' | ||
sshpass -p admin ssh -o StrictHostKeyChecking=no -p ${toString nodes.machine.config.services.macos-ventura.sshPort} [email protected] sw_vers | grep ProductVersion | awk '{print $2}' | ||
''; | ||
in '' | ||
start_all() | ||
machine.wait_for_unit("multi-user.target") | ||
machine.wait_for_unit("macos-ventura.service") | ||
machine.wait_for_open_port(2222) | ||
machine.wait_for_open_port(${toString nodes.machine.config.services.macos-ventura.sshPort}) | ||
with subtest("Check that the macOS Ventura machine returns ProductVersion 13.6 via SSH"): | ||
assert "13.6" in machine.succeed("${sshProductVersion}") | ||
''; | ||
|