-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add first integrated test with nixosTest VM #307
Conversation
This is a first pass at adding integrated tests for keter. This works by spinning up a NixOS virtual machine, running keter as a systemd service on it, and probing it with an HTTP request. This can even be run on MacOS interactively, like this: ``` nix run \ .#checks.x86_64-darwin.integratedTests.driverInteractive \ -- --interactive ```
I'm going to merge this now, but happy to address any subsequent feedback. I'll mark the relevant issue as resolved also, since with this change we do indeed have some form of integrated testing. Resolves #258. |
}; | ||
} | ||
); | ||
} |
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.
fyi,
keter is upstreamed as a module in nixpkgs:
https://github.com/NixOS/nixpkgs/blob/335958709c637736c44fdfde6f8b7ca5c6bc8da0/nixos/modules/services/web-servers/keter/default.nix#L4
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.
I did see that, but I don't think the module definition is quite right for a couple of reasons. From memory,
- It doesn't support all of the possible configuration options for the global configuration
- It concerns itself with the bundle configuration, when it shouldn't
The comment describing the indirection is already a good hint that this is trying to do too much. The easiest thing to do is to delegate configuring this correctly to the user.
server.start() | ||
server.wait_for_unit("keter-ng.service") | ||
server.wait_for_open_port(80) | ||
server.succeed("curl localhost") |
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.
I'm not sure if this is able to distinct between bundle content and the default "hello keter" welcome message
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.
That's right — it won't. This test doesn't exercise bundle loading at all. We can add more tests later for exercising various bundle loading scenarios.
This is a first pass at adding integrated tests for keter. This works by spinning up a NixOS virtual machine, running keter as a systemd service on it, and probing it with HTTP requests.
This work brings us closer to resolving #258.
Working on this during Thaigersprint/thaigersprint-2025#1.