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