Add an automated VM test against a real Invoice Ninja instance
Adds an invoiceninja-nixos flake input and two things built from it: - nixosConfigurations.invoiceninja-test-nginx/-caddy: manual test VMs, re-exported as-is from that repo rather than redefined here — same principle as this crate being a client of the SDK, not a second implementation of it. - checks.invoiceninja-cli: an automated nixosTest (tests/, adapted from invoiceninja-nixos's own test scaffolding) that boots a real Invoice Ninja instance and runs the actual invoiceninja-cli binary against it - create/list/get/update/invoice/payment/delete across clients, invoices, and payments - rather than raw curl. tests/common.nix's module import had to change from a relative ../nixos-module/invoiceninja.nix (which doesn't exist here) to a parameter threaded from the flake input's nixosModules.invoiceninja. Building the VM pulls from the invoiceninja-nixos cachix cache via a nixConfig block, mirroring that repo's own. Also fixes a wrong assumption the first version of this test's final assertion made, caught by actually running it against a real server: `clients list` with no `--status` does not exclude soft-deleted records - confirmed empirically (Invoice Ninja returns everything regardless of is_deleted unless status=active is passed explicitly). Corrected the test to check is_deleted via `clients get` instead, and fixed the misleadingly-incomplete --status doc comment in cli.rs that had the same wrong assumption baked in. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
{ proxyServer ? "nginx", invoiceninjaModule }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
# Unlike the invoiceninja-nixos repo this was copied from, there's no
|
||||
# sibling `nixos-module/` directory here — the module comes in through
|
||||
# this parameter instead, threaded from flake.nix as
|
||||
# `invoiceninja-nixos.nixosModules.invoiceninja` (the flake input). The
|
||||
# module's own `../package.nix` relative import inside that file still
|
||||
# resolves correctly regardless of who imports it, since it's relative to
|
||||
# the module file's own location in the Nix store, not to this directory.
|
||||
imports = [ invoiceninjaModule ];
|
||||
|
||||
services.invoiceninja = {
|
||||
enable = true;
|
||||
proxy.server = proxyServer;
|
||||
adminAccount.passwordFile = ./invoice_ninja_test_password;
|
||||
secretFile = ./test.env;
|
||||
settings.APP_DEBUG = true;
|
||||
};
|
||||
|
||||
networking.firewall.enable = false;
|
||||
}
|
||||
Reference in New Issue
Block a user