1 import ./make-test-python.nix ({ pkgs, lib, ...} : {
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [ ma27 ];
7 nodes.machine = { pkgs, ... }: {
8 environment.systemPackages = [ pkgs.jq ];
13 dbtype = "postgresql";
14 db = "host=localhost port=5432 sslmode=disable user=documize password=documize dbname=documize";
17 systemd.services.documize-server = {
18 after = [ "postgresql.service" ];
19 requires = [ "postgresql.service" ];
22 services.postgresql = {
24 initialScript = pkgs.writeText "psql-init" ''
25 CREATE ROLE documize WITH LOGIN PASSWORD 'documize';
26 CREATE DATABASE documize WITH OWNER documize;
34 machine.wait_for_unit("documize-server.service")
35 machine.wait_for_open_port(3000)
37 dbhash = machine.succeed(
38 "curl -f localhost:3000 | grep 'property=\"dbhash' | grep -Po 'content=\"\\K[^\"]*'"
41 dbhash = dbhash.strip()
46 " --data 'dbname=documize'"
48 " --data 'title=NixOS'"
49 " --data 'message=Docs'"
50 " --data 'firstname=Bob'"
51 " --data 'lastname=Foobar'"
52 " --data 'email=bob.foobar@nixos.org'"
53 " --data 'password=verysafe'"
54 " -f localhost:3000/api/setup"
59 'test "$(curl -f localhost:3000/api/public/meta | jq ".title" | xargs echo)" = "NixOS"'