From 062f14eb55622277bd5e37006b5447a82d02ee15 Mon Sep 17 00:00:00 2001 From: pjan vandaele Date: Thu, 4 Jan 2018 15:36:33 +0900 Subject: [PATCH] Closes #47. Adds tests for networking --- modules/networking/default.nix | 1 + release.nix | 1 + tests/networking.nix | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 tests/networking.nix diff --git a/modules/networking/default.nix b/modules/networking/default.nix index 634618e1..38401458 100644 --- a/modules/networking/default.nix +++ b/modules/networking/default.nix @@ -10,6 +10,7 @@ let scutil --set ComputerName "${cfg.hostName}" scutil --set LocalHostName "${cfg.hostName}" scutil --set HostName "${cfg.hostName}" + defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string '${cfg.hostName}' ''; in diff --git a/release.nix b/release.nix index af1f5069..df35a0bf 100644 --- a/release.nix +++ b/release.nix @@ -91,6 +91,7 @@ let tests.environment-path = makeTest ./tests/environment-path.nix; tests.launchd-setenv = makeTest ./tests/launchd-setenv.nix; + tests.networking = makeTest ./tests/networking.nix; tests.services-activate-system = makeTest ./tests/services-activate-system.nix; tests.system-defaults-write = makeTest ./tests/system-defaults-write.nix; tests.system-packages = makeTest ./tests/system-packages.nix; diff --git a/tests/networking.nix b/tests/networking.nix new file mode 100644 index 00000000..35aaaa30 --- /dev/null +++ b/tests/networking.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + networking.hostName = "EVE"; + + test = '' + echo checking hostname write in /activate >&2 + grep 'scutil --set ComputerName "EVE"' ${config.out}/activate + grep 'scutil --set LocalHostName "EVE"' ${config.out}/activate + grep 'scutil --set HostName "EVE"' ${config.out}/activate + grep "defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string 'EVE'" ${config.out}/activate + ''; +}