summaryrefslogtreecommitdiffstats
path: root/nixos/tests/hound.nix
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2016-10-12 18:58:56 -0400
committerGraham Christensen <graham@grahamc.com>2016-10-15 13:54:59 -0400
commit6c7a605714b8971f889887e68f44e0ec1461012a (patch)
tree21d18f3d1f95e478ad0466c38c31e20582e1c890 /nixos/tests/hound.nix
parent14384f02e86800b70527265b611d6f6788b3ba99 (diff)
hound: init module
Diffstat (limited to 'nixos/tests/hound.nix')
-rw-r--r--nixos/tests/hound.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/nixos/tests/hound.nix b/nixos/tests/hound.nix
new file mode 100644
index 000000000000..82fd44e8e36f
--- /dev/null
+++ b/nixos/tests/hound.nix
@@ -0,0 +1,58 @@
+# Test whether `houndd` indexes nixpkgs
+import ./make-test.nix ({ pkgs, ... } : {
+ name = "hound";
+ meta = with pkgs.stdenv.lib.maintainers; {
+ maintainers = [ grahamc ];
+ };
+ machine = { config, pkgs, ... }: {
+ services.hound = {
+ enable = true;
+ config = ''
+ {
+ "max-concurrent-indexers": 1,
+ "dbpath": "/var/lib/hound/data",
+ "repos": {
+ "nix": {
+ "url": "file:///var/lib/hound/my-git"
+ }
+ }
+ }
+ '';
+ };
+
+ systemd.services.houndseed = {
+ description = "seed hound with a git repo";
+ requiredBy = [ "hound.service" ];
+ before = [ "hound.service" ];
+
+ serviceConfig = {
+ User = "hound";
+ Group = "hound";
+ WorkingDirectory = "/var/lib/hound";
+ };
+ path = [ pkgs.git ];
+ script = ''
+ git config --global user.email "you@example.com"
+ git config --global user.name "Your Name"
+ git init my-git --bare
+ git init my-git-clone
+ cd my-git-clone
+ echo 'hi nix!' > hello
+ git add hello
+ git commit -m "hello there :)"
+ git remote add origin /var/lib/hound/my-git
+ git push origin master
+ '';
+ };
+ };
+
+ testScript =
+ '' startAll;
+
+ $machine->waitForUnit("network.target");
+ $machine->waitForUnit("hound.service");
+ $machine->waitForOpenPort(6080);
+ $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"');
+
+ '';
+})