1 import ./make-test-python.nix ({ pkgs, ... }: {
3 meta.maintainers = with pkgs.lib.maintainers; [ Guanran928 ];
6 environment.systemPackages = [ pkgs.curl ];
15 configFile = pkgs.writeTextFile {
19 external-controller: 127.0.0.1:9090
28 # Wait until it starts
29 machine.wait_for_unit("nginx.service")
30 machine.wait_for_unit("mihomo.service")
31 machine.wait_for_open_port(80)
32 machine.wait_for_open_port(7890)
33 machine.wait_for_open_port(9090)
36 machine.succeed("curl --fail --max-time 10 --proxy http://user:supersecret@localhost:7890 http://localhost")
37 machine.succeed("curl --fail --max-time 10 --proxy socks5://user:supersecret@localhost:7890 http://localhost")
38 machine.fail("curl --fail --max-time 10 --proxy http://user:supervillain@localhost:7890 http://localhost")
39 machine.fail("curl --fail --max-time 10 --proxy socks5://user:supervillain@localhost:7890 http://localhost")
42 machine.succeed("curl --fail http://localhost:9090") == '{"hello":"clash"}'