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