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 seafileSettings.fileserver.host = "unix:/run/seafile/server.sock";
18 adminEmail = "admin@example.com";
19 initialAdminPassword = "seafile_password";
23 virtualHosts."server" = {
24 locations."/".proxyPass = "http://unix:/run/seahub/gunicorn.sock";
25 locations."/seafhttp" = {
26 proxyPass = "http://unix:/run/seafile/server.sock";
28 rewrite ^/seafhttp(.*)$ $1 break;
29 client_max_body_size 0;
30 proxy_connect_timeout 36000s;
31 proxy_read_timeout 36000s;
32 proxy_send_timeout 36000s;
34 proxy_http_version 1.1;
39 networking.firewall = { allowedTCPPorts = [ 80 ]; };
41 client1 = client pkgs;
42 client2 = client pkgs;
48 with subtest("start seaf-server"):
49 server.wait_for_unit("seaf-server.service")
50 server.wait_for_file("/run/seafile/seafile.sock")
52 with subtest("start seahub"):
53 server.wait_for_unit("seahub.service")
54 server.wait_for_unit("nginx.service")
55 server.wait_for_file("/run/seahub/gunicorn.sock")
57 with subtest("client1 fetch seahub page"):
58 client1.succeed("curl -L http://server | grep 'Log In' >&2")
60 with subtest("client1 connect"):
61 client1.wait_for_unit("default.target")
62 client1.succeed("seaf-cli init -d . >&2")
63 client1.succeed("seaf-cli start >&2")
65 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password >&2"
68 libid = client1.succeed(
69 'seaf-cli create -s http://server -n test01 -u admin\@example.com -p seafile_password -t "first test library"'
73 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password |grep test01"
76 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password |grep test02"
80 f"seaf-cli download -l {libid} -s http://server -u admin\@example.com -p seafile_password -d . >&2"
83 client1.wait_until_succeeds("seaf-cli status |grep synchronized >&2")
85 client1.succeed("ls -la >&2")
86 client1.succeed("ls -la test01 >&2")
88 client1.execute("echo bla > test01/first_file")
90 client1.wait_until_succeeds("seaf-cli status |grep synchronized >&2")
92 with subtest("client2 sync"):
93 client2.wait_for_unit("default.target")
95 client2.succeed("seaf-cli init -d . >&2")
96 client2.succeed("seaf-cli start >&2")
99 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password >&2"
102 libid = client2.succeed(
103 "seaf-cli list-remote -s http://server -u admin\@example.com -p seafile_password |grep test01 |cut -d' ' -f 2"
107 f"seaf-cli download -l {libid} -s http://server -u admin\@example.com -p seafile_password -d . >&2"
110 client2.wait_until_succeeds("seaf-cli status |grep synchronized >&2")
112 client2.succeed("ls -la test01 >&2")
114 client2.succeed('[ `cat test01/first_file` = "bla" ]')