1 import ./make-test-python.nix ({ pkgs, ... }:
3 client = { config, pkgs, ... }: {
4 environment.systemPackages = [ pkgs.seafile-shared pkgs.curl ];
8 meta = with pkgs.lib.maintainers; {
9 maintainers = [ kampfschlaefer schmittlauch ];
13 server = { config, pkgs, ... }: {
16 ccnetSettings.General.SERVICE_URL = "http://server";
17 adminEmail = "admin@example.com";
18 initialAdminPassword = "seafile_password";
22 virtualHosts."server" = {
23 locations."/".proxyPass = "http://unix:/run/seahub/gunicorn.sock";
24 locations."/seafhttp" = {
25 proxyPass = "http://127.0.0.1:8082";
27 rewrite ^/seafhttp(.*)$ $1 break;
28 client_max_body_size 0;
29 proxy_connect_timeout 36000s;
30 proxy_read_timeout 36000s;
31 proxy_send_timeout 36000s;
33 proxy_http_version 1.1;
38 networking.firewall = { allowedTCPPorts = [ 80 ]; };
40 client1 = client pkgs;
41 client2 = client pkgs;
47 with subtest("start seaf-server"):
48 server.wait_for_unit("seaf-server.service")
49 server.wait_for_file("/run/seafile/seafile.sock")
51 with subtest("start seahub"):
52 server.wait_for_unit("seahub.service")
53 server.wait_for_unit("nginx.service")
54 server.wait_for_file("/run/seahub/gunicorn.sock")
56 with subtest("client1 fetch seahub page"):
57 client1.succeed("curl -L http://server | grep 'Log In' >&2")
59 with subtest("client1 connect"):
60 client1.wait_for_unit("default.target")
61 client1.succeed("seaf-cli init -d . >&2")
62 client1.succeed("seaf-cli start >&2")
64 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password >&2"
67 libid = client1.succeed(
68 'seaf-cli create -s http://server -n test01 -u admin\@example.com -p seafile_password -t "first test library"'
72 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password |grep test01"
75 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password |grep test02"
79 f"seaf-cli download -l {libid} -s http://server -u admin\@example.com -p seafile_password -d . >&2"
82 client1.wait_until_succeeds("seaf-cli status |grep synchronized >&2")
84 client1.succeed("ls -la >&2")
85 client1.succeed("ls -la test01 >&2")
87 client1.execute("echo bla > test01/first_file")
89 client1.wait_until_succeeds("seaf-cli status |grep synchronized >&2")
91 with subtest("client2 sync"):
92 client2.wait_for_unit("default.target")
94 client2.succeed("seaf-cli init -d . >&2")
95 client2.succeed("seaf-cli start >&2")
98 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password >&2"
101 libid = client2.succeed(
102 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password |grep test01 |cut -d' ' -f 2"
106 f"seaf-cli download -l {libid} -s http://server -u admin\@example.com -p seafile_password -d . >&2"
109 client2.wait_until_succeeds("seaf-cli status |grep synchronized >&2")
111 client2.succeed("ls -la test01 >&2")
113 client2.succeed('[ `cat test01/first_file` = "bla" ]')