Skip to content

Commit dd205c3

Browse files
committed
Add nixos VM integration test
1 parent 1d2cfe3 commit dd205c3

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

flake.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@
6262
pillowHeifOverrides = import ./lib/overrides-pillow-heif.nix { inherit pkgs; };
6363
psycopgOverrides = import ./lib/overrides-psycopg.nix { inherit pkgs; };
6464
opencvOverrides = import ./lib/overrides-opencv.nix { inherit pkgs; };
65-
strykeforceOverrides = import ./lib/overrides-strykeforce.nix { inherit pkgs workspace; };
65+
strykeforceOverrides = import ./lib/overrides-strykeforce.nix {
66+
inherit lib pkgs workspace;
67+
nixosModule = self.nixosModules.default;
68+
};
6669
tbaApiOverrides = import ./lib/overrides-tba-api-v3client.nix { inherit pkgs; };
6770
in
6871
baseSet.overrideScope (

lib/overrides-strykeforce.nix

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
# lib,
3-
# nixosModule,
2+
lib,
3+
nixosModule,
44
pkgs,
55
workspace,
66
}:
@@ -33,6 +33,57 @@ final: prev: {
3333
runHook postBuild
3434
'';
3535
};
36+
}
37+
// lib.optionalAttrs isLinux {
38+
nixos =
39+
let
40+
secrets = pkgs.writeText "strykeforce-test-secrets" ''
41+
SECRET_KEY="not-a-secret"
42+
TBA_READ_KEY=
43+
SENTRY_DSN=
44+
EMAIL_HOST_USER=
45+
EMAIL_HOST_PASSWORD=
46+
'';
47+
in
48+
pkgs.nixosTest {
49+
name = "strykeforce-nixos-test";
50+
51+
nodes.machine =
52+
{ ... }:
53+
{
54+
imports = [
55+
nixosModule
56+
];
57+
58+
strykeforce.services.website = {
59+
enable = true;
60+
ssl = false;
61+
secrets = [ secrets ];
62+
};
63+
64+
services.postgresql = {
65+
enable = true;
66+
package = pkgs.postgresql_16;
67+
ensureDatabases = [ "strykeforce" ];
68+
ensureUsers = [
69+
{
70+
name = "strykeforce";
71+
ensureDBOwnership = true;
72+
}
73+
];
74+
};
75+
76+
system.stateVersion = "24.11";
77+
};
78+
79+
testScript =
80+
{ nodes, ... }:
81+
''
82+
# wait for service
83+
machine.wait_for_unit("strykeforce-website.service")
84+
machine.wait_until_succeeds("curl -sLf http://localhost:8000/static/2767/main.css")
85+
'';
86+
};
3687
};
3788
};
3889
});

0 commit comments

Comments
 (0)