1# Test whether `houndd` indexes nixpkgs
2import ./make-test.nix ({ pkgs, ... } : {
3 name = "hound";
4 meta = with pkgs.stdenv.lib.maintainers; {
5 maintainers = [ grahamc ];
6 };
7 machine = { pkgs, ... }: {
8 services.hound = {
9 enable = true;
10 config = ''
11 {
12 "max-concurrent-indexers": 1,
13 "dbpath": "/var/lib/hound/data",
14 "repos": {
15 "nix": {
16 "url": "file:///var/lib/hound/my-git"
17 }
18 }
19 }
20 '';
21 };
22
23 systemd.services.houndseed = {
24 description = "seed hound with a git repo";
25 requiredBy = [ "hound.service" ];
26 before = [ "hound.service" ];
27
28 serviceConfig = {
29 User = "hound";
30 Group = "hound";
31 WorkingDirectory = "/var/lib/hound";
32 };
33 path = [ pkgs.git ];
34 script = ''
35 git config --global user.email "you@example.com"
36 git config --global user.name "Your Name"
37 git init my-git --bare
38 git init my-git-clone
39 cd my-git-clone
40 echo 'hi nix!' > hello
41 git add hello
42 git commit -m "hello there :)"
43 git remote add origin /var/lib/hound/my-git
44 git push origin master
45 '';
46 };
47 };
48
49 testScript =
50 '' startAll;
51
52 $machine->waitForUnit("network.target");
53 $machine->waitForUnit("hound.service");
54 $machine->waitForOpenPort(6080);
55 $machine->succeed('curl http://127.0.0.1:6080/api/v1/search\?stats\=fosho\&repos\=\*\&rng=%3A20\&q\=hi\&files\=\&i=nope | grep "Filename" | grep "hello"');
56
57 '';
58})