[Backport release-26.05] nixos/tests/flaresolverr: fetch local webpage (#567938)

This commit is contained in:
Diogo Correia
2026-09-28 17:01:30 +00:00
committed by GitHub

View File

@@ -10,11 +10,30 @@
enable = true;
port = 8888;
};
services.nginx = {
enable = true;
virtualHosts.localhost = {
locations."/" = {
return = "200 'hello world'";
extraConfig = ''
default_type text/plain;
'';
};
};
};
};
testScript = ''
testScript = /* python */ ''
import json
machine.wait_for_unit("flaresolverr.service")
machine.wait_for_open_port(8888)
machine.succeed("curl --fail http://localhost:8888/")
res = machine.succeed("""curl --fail http://localhost:8888/v1 -X POST --json '{ "cmd": "request.get", "url": "http://localhost/", "maxTimeout": 10000 }'""")
res = json.loads(res)
response = res["solution"]["response"]
assert "hello world" in response, f"Could not find 'hello world' in response: {response}"
'';
}