1{ pkgs
2, extraInit ? ""
3, extraShutdown ? ""
4}:
5
6''
7 start_all()
8
9 ${extraInit}
10
11 server.wait_for_unit("redis-mastodon.service")
12 server.wait_for_unit("mastodon-sidekiq-all.service")
13 server.wait_for_unit("mastodon-streaming.target")
14 server.wait_for_unit("mastodon-web.service")
15 server.wait_for_open_port(55001)
16
17 # Check that mastodon-media-auto-remove is scheduled
18 server.succeed("systemctl status mastodon-media-auto-remove.timer")
19
20 # Check Mastodon version from remote client
21 client.succeed("curl --fail https://mastodon.local/api/v1/instance | jq -r '.version' | grep '${pkgs.mastodon.version}'")
22
23 # Check access from remote client
24 client.succeed("curl --fail https://mastodon.local/about | grep 'Mastodon hosted on mastodon.local'")
25 client.succeed("curl --fail $(curl https://mastodon.local/api/v1/instance 2> /dev/null | jq -r .thumbnail) --output /dev/null")
26
27 # Simple check tootctl commands
28 # Check Mastodon version
29 server.succeed("mastodon-tootctl version | grep '${pkgs.mastodon.version}'")
30
31 # Manage accounts
32 server.succeed("mastodon-tootctl email_domain_blocks add example.com")
33 server.succeed("mastodon-tootctl email_domain_blocks list | grep example.com")
34 server.fail("mastodon-tootctl email_domain_blocks list | grep mastodon.local")
35 server.fail("mastodon-tootctl accounts create alice --email=alice@example.com")
36 server.succeed("mastodon-tootctl email_domain_blocks remove example.com")
37 server.succeed("mastodon-tootctl accounts create bob --email=bob@example.com")
38 server.succeed("mastodon-tootctl accounts approve bob")
39 server.succeed("mastodon-tootctl accounts delete bob")
40
41 # Manage IP access
42 server.succeed("mastodon-tootctl ip_blocks add 192.168.0.0/16 --severity=no_access")
43 server.succeed("mastodon-tootctl ip_blocks export | grep 192.168.0.0/16")
44 server.fail("mastodon-tootctl ip_blocks export | grep 172.16.0.0/16")
45 client.fail("curl --fail https://mastodon.local/about")
46 server.succeed("mastodon-tootctl ip_blocks remove 192.168.0.0/16")
47 client.succeed("curl --fail https://mastodon.local/about")
48
49 server.shutdown()
50 client.shutdown()
51
52 ${extraShutdown}
53''