blob: a71fb1743c76f8316e9794142d3157495a431b19 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import ./make-test-python.nix ({ lib, pkgs, ... }:
let
port = 5000;
scanPath = "/var/lib/legit";
in
{
name = "legit-web";
meta.maintainers = [ lib.maintainers.ratsclub ];
nodes = {
server = { config, pkgs, ... }: {
services.legit = {
enable = true;
settings = {
server.port = 5000;
repo = { inherit scanPath; };
};
};
environment.systemPackages = [ pkgs.git ];
};
};
testScript = { nodes, ... }:
let
strPort = builtins.toString port;
in
''
start_all()
server.wait_for_unit("network.target")
server.wait_for_unit("legit.service")
server.wait_until_succeeds(
"curl -f http://localhost:${strPort}"
)
server.succeed("${pkgs.writeShellScript "setup-legit-test-repo" ''
set -e
git init --bare -b master ${scanPath}/some-repo
git init -b master reference
cd reference
git remote add origin ${scanPath}/some-repo
date > date.txt
git add date.txt
git -c user.name=test -c user.email=test@localhost commit -m 'add date'
git push -u origin master
''}")
server.wait_until_succeeds(
"curl -f http://localhost:${strPort}/some-repo"
)
'';
})
|