-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flake/tests: pass testProfile as a shared arg
- Loading branch information
Showing
3 changed files
with
42 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,56 @@ | ||
{ | ||
nixosTest, | ||
nixosModules, | ||
testProfile, | ||
... | ||
}: | ||
nixosTest { | ||
name = "nixos-test"; | ||
|
||
nodes.machine = { | ||
imports = [ | ||
testProfile | ||
nixosModules.nvf | ||
../profiles/minimal.nix | ||
]; | ||
|
||
config = { | ||
programs.nvf.enable = true; | ||
}; | ||
}; | ||
|
||
testScript = ""; | ||
testScript = '' | ||
import subprocess | ||
machine.wait_for_unit("default.target") | ||
def check_errs(process): | ||
# Check for errors | ||
print("Connecting to Neovim process") | ||
# Capture stdout and stderr | ||
stdout, stderr = process.communicate() | ||
# Print captured stdout and stderr | ||
if stdout: | ||
print("Captured stdout:") | ||
print(stdout.decode('utf-8')) | ||
if stderr: | ||
print("Captured stderr:") | ||
print(stderr.decode('utf-8')) | ||
def run_neovim_headless(): | ||
print("Running Neovim in headless mode.") | ||
# Run Neovim in headless mode | ||
nvim_process = subprocess.Popen(['nvim', '--headless'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
check_errs(nvim_process) | ||
# Load configuration file | ||
nvim_process.stdin.write(b':NonExistentCommand\n') | ||
nvim_process.stdin.flush() | ||
# run Neovim in headless mode | ||
# and expect it to return sucessfully | ||
machine.succeed(run_neovim_headless()) | ||
''; | ||
} |
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