parent
85af9bd36d
commit
3c1d5bb96b
@ -578,7 +578,7 @@ in {
|
|||||||
installer = handleTest ./installer.nix {};
|
installer = handleTest ./installer.nix {};
|
||||||
installer-systemd-stage-1 = handleTest ./installer-systemd-stage-1.nix {};
|
installer-systemd-stage-1 = handleTest ./installer-systemd-stage-1.nix {};
|
||||||
intune = handleTest ./intune.nix {};
|
intune = handleTest ./intune.nix {};
|
||||||
invoiceplane = handleTest ./invoiceplane.nix {};
|
invoiceplane = runTest ./invoiceplane.nix;
|
||||||
iodine = handleTest ./iodine.nix {};
|
iodine = handleTest ./iodine.nix {};
|
||||||
ipv6 = handleTest ./ipv6.nix {};
|
ipv6 = handleTest ./ipv6.nix {};
|
||||||
iscsi-multipath-root = handleTest ./iscsi-multipath-root.nix {};
|
iscsi-multipath-root = handleTest ./iscsi-multipath-root.nix {};
|
||||||
|
@ -1,118 +1,116 @@
|
|||||||
import ./make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "invoiceplane";
|
name = "invoiceplane";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
maintainers = [
|
maintainers = [
|
||||||
onny
|
onny
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
invoiceplane_caddy =
|
invoiceplane_caddy =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
services.invoiceplane.webserver = "caddy";
|
services.invoiceplane.webserver = "caddy";
|
||||||
services.invoiceplane.sites = {
|
services.invoiceplane.sites = {
|
||||||
"site1.local" = {
|
"site1.local" = {
|
||||||
database.name = "invoiceplane1";
|
database.name = "invoiceplane1";
|
||||||
database.createLocally = true;
|
database.createLocally = true;
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
"site2.local" = {
|
"site2.local" = {
|
||||||
database.name = "invoiceplane2";
|
database.name = "invoiceplane2";
|
||||||
database.createLocally = true;
|
database.createLocally = true;
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
||||||
networking.hosts."127.0.0.1" = [
|
|
||||||
"site1.local"
|
|
||||||
"site2.local"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
invoiceplane_nginx =
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
{ ... }:
|
networking.hosts."127.0.0.1" = [
|
||||||
{
|
"site1.local"
|
||||||
services.invoiceplane.webserver = "nginx";
|
"site2.local"
|
||||||
services.invoiceplane.sites = {
|
];
|
||||||
"site1.local" = {
|
};
|
||||||
database.name = "invoiceplane1";
|
|
||||||
database.createLocally = true;
|
invoiceplane_nginx =
|
||||||
enable = true;
|
{ ... }:
|
||||||
};
|
{
|
||||||
"site2.local" = {
|
services.invoiceplane.webserver = "nginx";
|
||||||
database.name = "invoiceplane2";
|
services.invoiceplane.sites = {
|
||||||
database.createLocally = true;
|
"site1.local" = {
|
||||||
enable = true;
|
database.name = "invoiceplane1";
|
||||||
};
|
database.createLocally = true;
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
"site2.local" = {
|
||||||
|
database.name = "invoiceplane2";
|
||||||
|
database.createLocally = true;
|
||||||
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
||||||
networking.hosts."127.0.0.1" = [
|
|
||||||
"site1.local"
|
|
||||||
"site2.local"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
testScript = ''
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
start_all()
|
networking.hosts."127.0.0.1" = [
|
||||||
|
"site1.local"
|
||||||
|
"site2.local"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
invoiceplane_caddy.wait_for_unit("caddy")
|
testScript = ''
|
||||||
invoiceplane_nginx.wait_for_unit("nginx")
|
start_all()
|
||||||
|
|
||||||
site_names = ["site1.local", "site2.local"]
|
invoiceplane_caddy.wait_for_unit("caddy")
|
||||||
|
invoiceplane_nginx.wait_for_unit("nginx")
|
||||||
|
|
||||||
machines = [invoiceplane_caddy, invoiceplane_nginx]
|
site_names = ["site1.local", "site2.local"]
|
||||||
|
|
||||||
for machine in machines:
|
machines = [invoiceplane_caddy, invoiceplane_nginx]
|
||||||
machine.wait_for_open_port(80)
|
|
||||||
machine.wait_for_open_port(3306)
|
|
||||||
|
|
||||||
for site_name in site_names:
|
for machine in machines:
|
||||||
machine.wait_for_unit(f"phpfpm-invoiceplane-{site_name}")
|
machine.wait_for_open_port(80)
|
||||||
|
machine.wait_for_open_port(3306)
|
||||||
|
|
||||||
with subtest("Website returns welcome screen"):
|
for site_name in site_names:
|
||||||
assert "Please install InvoicePlane" in machine.succeed(f"curl -L {site_name}")
|
machine.wait_for_unit(f"phpfpm-invoiceplane-{site_name}")
|
||||||
|
|
||||||
with subtest("Finish InvoicePlane setup"):
|
with subtest("Website returns welcome screen"):
|
||||||
machine.succeed(
|
assert "Please install InvoicePlane" in machine.succeed(f"curl -L {site_name}")
|
||||||
f"curl -sSfL --cookie-jar cjar {site_name}/setup/language"
|
|
||||||
)
|
with subtest("Finish InvoicePlane setup"):
|
||||||
csrf_token = machine.succeed(
|
machine.succeed(
|
||||||
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
f"curl -sSfL --cookie-jar cjar {site_name}/setup/language"
|
||||||
)
|
)
|
||||||
machine.succeed(
|
csrf_token = machine.succeed(
|
||||||
f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&ip_lang=english&btn_continue=Continue' {site_name}/setup/language"
|
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
||||||
)
|
)
|
||||||
csrf_token = machine.succeed(
|
machine.succeed(
|
||||||
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&ip_lang=english&btn_continue=Continue' {site_name}/setup/language"
|
||||||
)
|
)
|
||||||
machine.succeed(
|
csrf_token = machine.succeed(
|
||||||
f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/prerequisites"
|
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
||||||
)
|
)
|
||||||
csrf_token = machine.succeed(
|
machine.succeed(
|
||||||
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/prerequisites"
|
||||||
)
|
)
|
||||||
machine.succeed(
|
csrf_token = machine.succeed(
|
||||||
f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/configure_database"
|
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
||||||
)
|
)
|
||||||
csrf_token = machine.succeed(
|
machine.succeed(
|
||||||
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/configure_database"
|
||||||
)
|
)
|
||||||
machine.succeed(
|
csrf_token = machine.succeed(
|
||||||
f"curl -sSfl --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/install_tables"
|
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
||||||
)
|
)
|
||||||
csrf_token = machine.succeed(
|
machine.succeed(
|
||||||
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
f"curl -sSfl --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/install_tables"
|
||||||
)
|
)
|
||||||
machine.succeed(
|
csrf_token = machine.succeed(
|
||||||
f"curl -sSfl --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/upgrade_tables"
|
"grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
|
||||||
)
|
)
|
||||||
'';
|
machine.succeed(
|
||||||
}
|
f"curl -sSfl --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/upgrade_tables"
|
||||||
)
|
)
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user