1 import ./make-test-python.nix ({ pkgs, lib, ...}:
7 meta = with pkgs.stdenv.lib.maintainers; {
8 maintainers = [ fpletz ];
15 { environment.systemPackages = with pkgs; [ jq ];
16 services.couchdb.enable = true;
22 { environment.systemPackages = with pkgs; [ jq ];
23 services.couchdb.enable = true;
24 services.couchdb.package = pkgs.couchdb2;
29 curlJqCheck = action: path: jqexpr: result:
30 pkgs.writeScript "curl-jq-check-${action}-${path}.sh" ''
31 RESULT=$(curl -X ${action} http://127.0.0.1:5984/${path} | jq -r '${jqexpr}')
33 if [ "$RESULT" != "${result}" ]; then
40 couchdb1.wait_for_unit("couchdb.service")
41 couchdb1.wait_until_succeeds(
42 "${curlJqCheck "GET" "" ".couchdb" "Welcome"}"
44 couchdb1.wait_until_succeeds(
45 "${curlJqCheck "GET" "_all_dbs" ". | length" "2"}"
47 couchdb1.succeed("${curlJqCheck "PUT" "foo" ".ok" "true"}")
49 "${curlJqCheck "GET" "_all_dbs" ". | length" "3"}"
52 "${curlJqCheck "DELETE" "foo" ".ok" "true"}"
55 "${curlJqCheck "GET" "_all_dbs" ". | length" "2"}"
58 couchdb2.wait_for_unit("couchdb.service")
59 couchdb2.wait_until_succeeds(
60 "${curlJqCheck "GET" "" ".couchdb" "Welcome"}"
62 couchdb2.wait_until_succeeds(
63 "${curlJqCheck "GET" "_all_dbs" ". | length" "0"}"
65 couchdb2.succeed("${curlJqCheck "PUT" "foo" ".ok" "true"}")
67 "${curlJqCheck "GET" "_all_dbs" ". | length" "1"}"
70 "${curlJqCheck "DELETE" "foo" ".ok" "true"}"
73 "${curlJqCheck "GET" "_all_dbs" ". | length" "0"}"