-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OPS-1384] Introduce NixOS VM tests #264
Conversation
064e305
to
b8fd011
Compare
nix/tests/default.nix
Outdated
}; | ||
|
||
flake = builtins.toFile "flake.nix" '' | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is a .nix
file embedded in another .nix
file 😅
Will it be viable to extract it as a dedicated .nix
file that consumes inputs
as an import argument to simplify its editing in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, nix will attempt to eval the entire file that is intended to be evaluated during the test. Substituting the inputs block seems to me the simplest solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough
server.succeed("su ${user} -l -c 'hello | figlet' >&2") | ||
''; | ||
}; | ||
in { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nix/tests/default.nix
Outdated
let | ||
inherit (pkgs) system lib; | ||
|
||
privateKey = pkgs.writeText "privateKey" '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore my nitpick, but nixpkgs
has snakeOil
keypair that is used in NixOS tests within the nixpkgs
repo, perhaps we can reuse it instead of using newly generated key
.github/workflows/check.yml
Outdated
- name: check flake | ||
run: nix flake check -L | ||
- name: deploy-rs | ||
run: nix build -L .#checks.x86_64-linux.deploy-rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another nitpick, but at this point, it becomes a bit tedious to enumerate all checks (given that I also propose to extend the list of tests a bit), so perhaps, it's time to use a build-matrix instead
Problem: Currently, the only way to test deploy-rs deployments is to actually do a deployment to an existing NixOS instance (either in VM, or a real machine) manually. This is a bit inconvenient and one can forget to test changes when developing/reviewing deploy-rs changes. Solution: Add NixOS VM tests.
a096697
to
a928352
Compare
Problem: In my recent PR(#264), I accidentally picked overlay output changes from the philtaken/nixos-vm-tests branch, which broke existing overlay imports after updating the deployment-rs input. Solution: Add backwards compatibility so that users don't have to make changes to their nix flakes.
Problem: In my recent PR(#264), I accidentally picked overlay output changes from the philtaken/nixos-vm-tests branch, which broke existing overlay imports after updating the deploy-rs input. Solution: Add backwards compatibility so that users don't have to make changes to their nix flakes.
Problem: Currently, the only way to test deploy-rs deployments is to actually do a deployment to an existing NixOS instance (either in VM, or a real machine) manually. This is a bit inconvenient and one can forget to test changes when developing/reviewing deploy-rs changes.
Solution: Add NixOS VM tests.