Add a basic integration test #323

Merged
fricklerhandwerk merged 4 commits from Niols/Fediversity:integration-test into main 2025-04-30 15:03:37 +02:00
Owner

This PR adds a basic deployment test to the repository. This test will, in a NixOS test, run a deployer VM and a target VM, and check that we manage to run nixops4 apply on the deployer VM to change things on the target VM. The ideas are all @roberth's and this test has been extremely heavily inspired by https://github.com/nixops4/nixops4-nixos/blob/main/test/default/nixosTest.nix.

The interesting commit is bb605124ceb146e26ce344653df2d6d62ab12354.

Commits 64a015eca28095c7b18556d078b2b1ee8dd80776 and 1f3f8c9f5dde0a6c75bfe555b784addaa9695871 are lock manipulation commits that improve the run time of the test by removing nixpkgs duplication. They will probably clash with #311. The former, we should just have done a while ago. The latter is more debatable and I would rather do without, but it does half the test running time (from 4 to 2 minutes) on my test machine.

The goal of this PR is to serve as basis for future work, namely:

  1. A basic deployment of several machines, factorising the bits that can be reused. [WIP - needs polishing but otherwise looking good]
  2. A full deployment of Fediversity services triggered from command line. [WIP - just started]
  3. A full deployment of Fediversity services triggered from the panel.
This PR adds a basic deployment test to the repository. This test will, in a NixOS test, run a deployer VM and a target VM, and check that we manage to run `nixops4 apply` on the deployer VM to change things on the target VM. The ideas are all @roberth's and this test has been extremely heavily inspired by https://github.com/nixops4/nixops4-nixos/blob/main/test/default/nixosTest.nix. The interesting commit is bb605124ceb146e26ce344653df2d6d62ab12354. Commits 64a015eca28095c7b18556d078b2b1ee8dd80776 and 1f3f8c9f5dde0a6c75bfe555b784addaa9695871 are lock manipulation commits that improve the run time of the test by removing nixpkgs duplication. They will probably clash with https://git.fediversity.eu/Fediversity/Fediversity/pulls/311. The former, we should just have done a while ago. The latter is more debatable and I would rather do without, but it does half the test running time (from 4 to 2 minutes) on my test machine. The goal of this PR is to serve as basis for future work, namely: 1. A basic deployment of several machines, factorising the bits that can be reused. _[WIP - needs polishing but otherwise looking good]_ 2. A full deployment of Fediversity services triggered from command line. _[WIP - just started]_ 3. A full deployment of Fediversity services triggered from the panel.
kiara reviewed 2025-04-30 10:57:28 +02:00
flake.nix Outdated
@ -1,13 +1,14 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs.follows = "nixops4/nixpkgs";
Owner

i think this fell afoul of #318, breaking the peertube CI test

i think this fell afoul of #318, breaking the peertube CI test
Author
Owner

Yeah, that's also what I thought. I just now force-pushed a version of this PR without that commit, and we can discuss them independently.

Yeah, that's also what I thought. I just now force-pushed a version of this PR without that commit, and we can discuss them independently.
kiara marked this conversation as resolved
Niols force-pushed integration-test from 1f3f8c9f5d to 8503e45367 2025-04-30 10:58:24 +02:00 Compare
Niols force-pushed integration-test from 8503e45367 to 95fa8ab2e6 2025-04-30 10:59:57 +02:00 Compare
Author
Owner
unexpected client error: unexpected requesting "https://code.forgejo.org/actions/checkout/info/refs?service=git-upload-pack" status code: 503

Service unavailable - amazing. Indeed, code.forgejo.org seems down. Or when you're reminded that decentralisation in open source is not an easy problem.

Edit: it was transient and is already gone.

``` unexpected client error: unexpected requesting "https://code.forgejo.org/actions/checkout/info/refs?service=git-upload-pack" status code: 503 ``` Service unavailable - amazing. Indeed, code.forgejo.org seems down. Or when you're reminded that decentralisation in open source is not an easy problem. Edit: it was transient and is already gone.
kiara changed title from Add a basic integration test to WIP: Add a basic integration test 2025-04-30 11:09:21 +02:00
Author
Owner

In fact, this run was shorter than the one with nixpkgs.follows = "nixops4/nixpkgs", but I think this is mostly due to things being cached on the runner this time around. Either way, looks like CI is happy with this piece of work. I'll add the other ones in subsequent PRs.

In fact, this run was shorter than the one with `nixpkgs.follows = "nixops4/nixpkgs"`, but I think this is mostly due to things being cached on the runner this time around. Either way, looks like CI is happy with this piece of work. I'll add the other ones in subsequent PRs.
fricklerhandwerk changed title from WIP: Add a basic integration test to Add a basic integration test 2025-04-30 13:40:09 +02:00
Owner

hm, would it not be better to mark this as WIP while as per the current PR description that is its current status?

hm, would it not be better to mark this as WIP while as per the current PR description that is its current status?
fricklerhandwerk approved these changes 2025-04-30 14:05:07 +02:00
fricklerhandwerk left a comment
Owner

Nice, except the slightly weird factoring of nested imports. (Modulo failing tests due to nixpkgs bump -- do we need the bump?)

Nice, except the slightly weird factoring of nested imports. (Modulo failing tests due to nixpkgs bump -- do we need the bump?)
@ -0,0 +1,3 @@
{
imports = [ ./check/flake-part.nix ];

Why are we doing those two layers of imports?

Why are we doing those two layers of imports?
Author
Owner

What about flake.nix importing deployment/flake-part.nix, and this one importing all the checks directly? Or would you even rather flake.nix imports all the checks directly?

What about `flake.nix` importing `deployment/flake-part.nix`, and this one importing all the checks directly? Or would you even rather `flake.nix` imports all the checks directly?

I don't really care, but boilerplate files seem wrong. 💁

I don't really care, but boilerplate files seem wrong. 💁
Author
Owner

Fixed in 59038d2f30.

Fixed in 59038d2f30600f246043e9cbeed29922cbe5ca4e.
Niols marked this conversation as resolved

hm, would it not be better to mark this as WIP while as per the current PR description that is its current status?

@kiara the WIP in the PR description talks about follow-up work. This one is self-contained.

> hm, would it not be better to mark this as WIP while as per the current PR description that is its current status? @kiara the WIP in the PR description talks about follow-up work. This one is self-contained.
kiara added a new dependency 2025-04-30 14:22:59 +02:00
Niols force-pushed integration-test from 95fa8ab2e6 to cc6bff2630 2025-04-30 14:43:12 +02:00 Compare
fricklerhandwerk merged commit f5db62e053 into main 2025-04-30 15:03:37 +02:00
fricklerhandwerk deleted branch integration-test 2025-04-30 15:03:38 +02:00

I squashed it because the change is rather self-contained, and the individual commits didn't make all that much sense in isolation

I squashed it because the change is rather self-contained, and the individual commits didn't make all that much sense in isolation
Sign in to join this conversation.
No description provided.