blob: 2f5c0f8ec933b09193e7546854a139b1269ef847 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "frp";
meta.maintainers = with lib.maintainers; [ zaldnoay janik ];
nodes = {
frps = {
networking = {
useNetworkd = true;
useDHCP = false;
firewall.enable = false;
};
systemd.network.networks."01-eth1" = {
name = "eth1";
networkConfig.Address = "10.0.0.1/24";
};
services.frp = {
enable = true;
role = "server";
settings = {
common = {
bind_port = 7000;
vhost_http_port = 80;
};
};
};
};
frpc = {
networking = {
useNetworkd = true;
useDHCP = false;
};
systemd.network.networks."01-eth1" = {
name = "eth1";
networkConfig.Address = "10.0.0.2/24";
};
services.httpd = {
enable = true;
adminAddr = "admin@example.com";
virtualHosts."test-appication" =
let
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
in
{
documentRoot = "${testdir}/web";
locations."/" = {
index = "index.php index.html";
};
};
phpPackage = pkgs.php81;
enablePHP = true;
};
services.frp = {
enable = true;
role = "client";
settings = {
common = {
server_addr = "10.0.0.1";
server_port = 7000;
};
web = {
type = "http";
local_port = 80;
custom_domains = "10.0.0.1";
};
};
};
};
};
testScript = ''
start_all()
frps.wait_for_unit("frp.service")
frps.wait_for_open_port(80)
frpc.wait_for_unit("frp.service")
response = frpc.succeed("curl -fvvv -s http://127.0.0.1/")
assert "PHP Version ${pkgs.php81.version}" in response, "PHP version not detected"
response = frpc.succeed("curl -fvvv -s http://10.0.0.1/")
assert "PHP Version ${pkgs.php81.version}" in response, "PHP version not detected"
'';
})
|