Skip to content
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

Merged
merged 1 commit into from
Feb 14, 2025
Merged

Conversation

jezen
Copy link
Collaborator

@jezen jezen commented Feb 13, 2025

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.

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
```
@jezen jezen changed the title Add first integrated test with nixosTest VM (wip) Add first integrated test with nixosTest VM Feb 14, 2025
@jezen jezen marked this pull request as ready for review February 14, 2025 08:45
@jezen jezen requested a review from jappeace February 14, 2025 10:40
@jezen
Copy link
Collaborator Author

jezen commented Feb 14, 2025

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.

@jezen jezen merged commit 206b5d2 into snoyberg:master Feb 14, 2025
9 checks passed
@jezen jezen deleted the nixos-test branch February 14, 2025 10:42
};
}
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

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,

  1. It doesn't support all of the possible configuration options for the global configuration
  2. 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")
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants