nextcloud: test for all supported versions
This commit is contained in:
parent
78b5e59830
commit
a584decd52
2 changed files with 284 additions and 199 deletions
|
|
@ -1022,6 +1022,7 @@ in
|
||||||
${occ} app:enable user_ldap
|
${occ} app:enable user_ldap
|
||||||
|
|
||||||
${occ} config:app:set user_ldap ${cID}ldap_configuration_active --value=0
|
${occ} config:app:set user_ldap ${cID}ldap_configuration_active --value=0
|
||||||
|
${occ} config:app:set user_ldap configuration_prefixes --value '["${cID}"]'
|
||||||
|
|
||||||
# The following CLI commands follow
|
# The following CLI commands follow
|
||||||
# https://github.com/lldap/lldap/blob/main/example_configs/nextcloud.md#nextcloud-config--the-cli-way
|
# https://github.com/lldap/lldap/blob/main/example_configs/nextcloud.md#nextcloud-config--the-cli-way
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
{ lib, shb, ... }:
|
{ lib, shb, ... }:
|
||||||
let
|
let
|
||||||
|
supportedVersion = [
|
||||||
|
31
|
||||||
|
32
|
||||||
|
];
|
||||||
|
|
||||||
adminUser = "root";
|
adminUser = "root";
|
||||||
adminPass = "rootpw";
|
adminPass = "rootpw";
|
||||||
oidcSecret = "oidcSecret";
|
oidcSecret = "oidcSecret";
|
||||||
|
|
@ -149,7 +154,7 @@ let
|
||||||
startUrl = "http://${config.test.fqdn}";
|
startUrl = "http://${config.test.fqdn}";
|
||||||
usernameFieldLabelRegex = "Account name";
|
usernameFieldLabelRegex = "Account name";
|
||||||
passwordFieldLabelRegex = "^ *[Pp]assword";
|
passwordFieldLabelRegex = "^ *[Pp]assword";
|
||||||
loginButtonNameRegex = "[Ll]og [Ii]n";
|
loginButtonNameRegex = "^[Ll]og [Ii]n$";
|
||||||
testLoginWith = [
|
testLoginWith = [
|
||||||
{
|
{
|
||||||
username = adminUser;
|
username = adminUser;
|
||||||
|
|
@ -189,7 +194,7 @@ let
|
||||||
startUrl = "http://${config.test.fqdn}";
|
startUrl = "http://${config.test.fqdn}";
|
||||||
usernameFieldLabelRegex = "Account name";
|
usernameFieldLabelRegex = "Account name";
|
||||||
passwordFieldLabelRegex = "^ *[Pp]assword";
|
passwordFieldLabelRegex = "^ *[Pp]assword";
|
||||||
loginButtonNameRegex = "[Ll]og [Ii]n";
|
loginButtonNameRegex = "^[Ll]og [Ii]n$";
|
||||||
testLoginWith = [
|
testLoginWith = [
|
||||||
{
|
{
|
||||||
username = "alice";
|
username = "alice";
|
||||||
|
|
@ -442,252 +447,331 @@ let
|
||||||
)
|
)
|
||||||
print(response)
|
print(response)
|
||||||
'';
|
'';
|
||||||
in
|
|
||||||
{
|
|
||||||
basic = shb.test.runNixOSTest {
|
|
||||||
name = "nextcloud_basic";
|
|
||||||
|
|
||||||
nodes.client = {
|
basicTest =
|
||||||
imports = [
|
version:
|
||||||
clientLogin
|
shb.test.runNixOSTest {
|
||||||
];
|
name = "nextcloud_basic_${toString version}";
|
||||||
};
|
|
||||||
nodes.server = {
|
|
||||||
imports = [
|
|
||||||
basic
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
testScript = commonTestScript.access;
|
nodes.client = {
|
||||||
};
|
imports = [
|
||||||
|
clientLogin
|
||||||
cron = shb.test.runNixOSTest {
|
];
|
||||||
name = "nextcloud_cron";
|
};
|
||||||
|
nodes.server = {
|
||||||
nodes.server = {
|
|
||||||
imports = [
|
|
||||||
basic
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nodes.client = { };
|
|
||||||
|
|
||||||
testScript = commonTestScript.access.override {
|
|
||||||
extraScript =
|
|
||||||
{
|
|
||||||
node,
|
|
||||||
fqdn,
|
|
||||||
proto_fqdn,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
''
|
|
||||||
import time
|
|
||||||
|
|
||||||
def find_in_logs(unit, text):
|
|
||||||
return server.systemctl("status {}".format(unit))[1].find(text) != -1
|
|
||||||
|
|
||||||
with subtest("cron job succeeds"):
|
|
||||||
# This call does not block until the service is done.
|
|
||||||
server.succeed("systemctl start nextcloud-cron.service&")
|
|
||||||
|
|
||||||
# If the service failed, then we're not happy.
|
|
||||||
status = "active"
|
|
||||||
while status == "active":
|
|
||||||
status = server.get_unit_info("nextcloud-cron")["ActiveState"]
|
|
||||||
time.sleep(5)
|
|
||||||
if status != "inactive":
|
|
||||||
raise Exception("Cron job did not finish correctly")
|
|
||||||
|
|
||||||
if not find_in_logs("nextcloud-cron", "nextcloud-cron.service: Deactivated successfully."):
|
|
||||||
raise Exception("Nextcloud cron job did not finish successfully.")
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
backup = shb.test.runNixOSTest {
|
|
||||||
name = "nextcloud_backup";
|
|
||||||
|
|
||||||
nodes.server =
|
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
basic
|
basic
|
||||||
(shb.test.backup config.shb.nextcloud.backup)
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.client = { };
|
testScript = commonTestScript.access;
|
||||||
|
|
||||||
testScript = commonTestScript.backup;
|
|
||||||
};
|
|
||||||
|
|
||||||
https = shb.test.runNixOSTest {
|
|
||||||
name = "nextcloud_https";
|
|
||||||
|
|
||||||
nodes.server = {
|
|
||||||
imports = [
|
|
||||||
basic
|
|
||||||
shb.test.certs
|
|
||||||
https
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.client = { };
|
cronTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_cron_${toString version}";
|
||||||
|
|
||||||
# TODO: Test login
|
nodes.server = {
|
||||||
testScript = commonTestScript.access;
|
imports = [
|
||||||
};
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
previewGenerator = shb.test.runNixOSTest {
|
nodes.client = { };
|
||||||
name = "nextcloud_previewGenerator";
|
|
||||||
|
|
||||||
nodes.server = {
|
testScript = commonTestScript.access.override {
|
||||||
imports = [
|
extraScript =
|
||||||
basic
|
{
|
||||||
shb.test.certs
|
node,
|
||||||
https
|
fqdn,
|
||||||
previewgenerator
|
proto_fqdn,
|
||||||
];
|
...
|
||||||
|
}:
|
||||||
|
''
|
||||||
|
import time
|
||||||
|
|
||||||
|
def find_in_logs(unit, text):
|
||||||
|
return server.systemctl("status {}".format(unit))[1].find(text) != -1
|
||||||
|
|
||||||
|
with subtest("cron job succeeds"):
|
||||||
|
# This call does not block until the service is done.
|
||||||
|
server.succeed("systemctl start nextcloud-cron.service&")
|
||||||
|
|
||||||
|
# If the service failed, then we're not happy.
|
||||||
|
status = "active"
|
||||||
|
while status == "active":
|
||||||
|
status = server.get_unit_info("nextcloud-cron")["ActiveState"]
|
||||||
|
time.sleep(5)
|
||||||
|
if status != "inactive":
|
||||||
|
raise Exception("Cron job did not finish correctly")
|
||||||
|
|
||||||
|
if not find_in_logs("nextcloud-cron", "nextcloud-cron.service: Deactivated successfully."):
|
||||||
|
raise Exception("Nextcloud cron job did not finish successfully.")
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.client = { };
|
backupTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_backup_${toString version}";
|
||||||
|
|
||||||
testScript = commonTestScript.access;
|
nodes.server =
|
||||||
};
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
(shb.test.backup config.shb.nextcloud.backup)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
externalStorage = shb.test.runNixOSTest {
|
nodes.client = { };
|
||||||
name = "nextcloud_externalStorage";
|
|
||||||
|
|
||||||
nodes.server = {
|
testScript = commonTestScript.backup;
|
||||||
imports = [
|
|
||||||
basic
|
|
||||||
shb.test.certs
|
|
||||||
https
|
|
||||||
externalstorage
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.client = { };
|
httpsTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_https_${toString version}";
|
||||||
|
|
||||||
testScript = commonTestScript.access;
|
nodes.server = {
|
||||||
};
|
imports = [
|
||||||
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
shb.test.certs
|
||||||
|
https
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client = { };
|
||||||
|
|
||||||
|
# TODO: Test login
|
||||||
|
testScript = commonTestScript.access;
|
||||||
|
};
|
||||||
|
|
||||||
|
previewGeneratorTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_previewGenerator_${toString version}";
|
||||||
|
|
||||||
|
nodes.server = {
|
||||||
|
imports = [
|
||||||
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
shb.test.certs
|
||||||
|
https
|
||||||
|
previewgenerator
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client = { };
|
||||||
|
|
||||||
|
testScript = commonTestScript.access;
|
||||||
|
};
|
||||||
|
|
||||||
|
externalStorageTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_externalStorage_${toString version}";
|
||||||
|
|
||||||
|
nodes.server = {
|
||||||
|
imports = [
|
||||||
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
shb.test.certs
|
||||||
|
https
|
||||||
|
externalstorage
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client = { };
|
||||||
|
|
||||||
|
testScript = commonTestScript.access;
|
||||||
|
};
|
||||||
|
|
||||||
# TODO: fix memories app
|
# TODO: fix memories app
|
||||||
# See https://github.com/ibizaman/selfhostblocks/issues/476
|
# See https://github.com/ibizaman/selfhostblocks/issues/476
|
||||||
|
|
||||||
# memories = shb.test.runNixOSTest {
|
memoriesTest =
|
||||||
# name = "nextcloud_memories";
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_memories_${toString version}";
|
||||||
|
|
||||||
# nodes.server = {
|
nodes.server = {
|
||||||
# imports = [
|
|
||||||
# basic
|
|
||||||
# shb.test.certs
|
|
||||||
# https
|
|
||||||
# memories
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
# nodes.client = {};
|
|
||||||
|
|
||||||
# testScript = commonTestScript.access;
|
|
||||||
# };
|
|
||||||
|
|
||||||
recognize = shb.test.runNixOSTest {
|
|
||||||
name = "nextcloud_recognize";
|
|
||||||
|
|
||||||
nodes.server = {
|
|
||||||
imports = [
|
|
||||||
basic
|
|
||||||
shb.test.certs
|
|
||||||
https
|
|
||||||
recognize
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nodes.client = { };
|
|
||||||
|
|
||||||
testScript = commonTestScript.access;
|
|
||||||
};
|
|
||||||
|
|
||||||
ldap = shb.test.runNixOSTest {
|
|
||||||
name = "nextcloud_ldap";
|
|
||||||
|
|
||||||
nodes.server =
|
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
basic
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
shb.test.certs
|
shb.test.certs
|
||||||
https
|
https
|
||||||
shb.test.ldap
|
memories
|
||||||
ldap
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.client = {
|
nodes.client = { };
|
||||||
imports = [
|
|
||||||
clientLdapLogin
|
testScript = commonTestScript.access;
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = commonTestScript.access;
|
recognizeTest =
|
||||||
};
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_recognize_${toString version}";
|
||||||
|
|
||||||
sso = shb.test.runNixOSTest {
|
nodes.server = {
|
||||||
name = "nextcloud_sso";
|
|
||||||
|
|
||||||
nodes.server =
|
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
imports = [
|
||||||
basic
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
shb.test.certs
|
shb.test.certs
|
||||||
https
|
https
|
||||||
shb.test.ldap
|
recognize
|
||||||
(shb.test.sso config.shb.certs.certs.selfsigned.n)
|
];
|
||||||
sso
|
};
|
||||||
|
|
||||||
|
nodes.client = { };
|
||||||
|
|
||||||
|
testScript = commonTestScript.access;
|
||||||
|
};
|
||||||
|
|
||||||
|
ldapTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_ldap_${toString version}";
|
||||||
|
|
||||||
|
nodes.server =
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
shb.test.certs
|
||||||
|
https
|
||||||
|
shb.test.ldap
|
||||||
|
ldap
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client = {
|
||||||
|
imports = [
|
||||||
|
clientLdapLogin
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = commonTestScript.access;
|
||||||
|
};
|
||||||
|
|
||||||
|
ssoTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_sso_${toString version}";
|
||||||
|
|
||||||
|
nodes.server =
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
shb.test.certs
|
||||||
|
https
|
||||||
|
shb.test.ldap
|
||||||
|
(shb.test.sso config.shb.certs.certs.selfsigned.n)
|
||||||
|
sso
|
||||||
|
(
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
networking.hosts = {
|
||||||
|
"127.0.0.1" = [ config.test.fqdn ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client = {
|
||||||
|
imports = [
|
||||||
|
clientSsoLogin
|
||||||
(
|
(
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
networking.hosts = {
|
networking.hosts = {
|
||||||
"127.0.0.1" = [ config.test.fqdn ];
|
"192.168.1.2" = [ config.test.fqdn ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.client = {
|
testScript = commonTestScript.access;
|
||||||
imports = [
|
|
||||||
clientSsoLogin
|
|
||||||
(
|
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
networking.hosts = {
|
|
||||||
"192.168.1.2" = [ config.test.fqdn ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = commonTestScript.access;
|
prometheusTest =
|
||||||
|
version:
|
||||||
|
shb.test.runNixOSTest {
|
||||||
|
name = "nextcloud_prometheus_${toString version}";
|
||||||
|
|
||||||
|
nodes.server =
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
basic
|
||||||
|
{
|
||||||
|
shb.nextcloud.version = version;
|
||||||
|
}
|
||||||
|
prometheus
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client = { };
|
||||||
|
|
||||||
|
testScript = prometheusTestScript;
|
||||||
|
};
|
||||||
|
|
||||||
|
versionedTests = v: {
|
||||||
|
"basic_${toString v}" = basicTest v;
|
||||||
|
|
||||||
|
"cron_${toString v}" = cronTest v;
|
||||||
|
|
||||||
|
"backup_${toString v}" = backupTest v;
|
||||||
|
|
||||||
|
"https_${toString v}" = httpsTest v;
|
||||||
|
|
||||||
|
"previewGenerator_${toString v}" = previewGeneratorTest v;
|
||||||
|
|
||||||
|
"externalStorage_${toString v}" = externalStorageTest v;
|
||||||
|
|
||||||
|
"memories_${toString v}" = memoriesTest v;
|
||||||
|
|
||||||
|
"recognize_${toString v}" = recognizeTest v;
|
||||||
|
|
||||||
|
"ldap_${toString v}" = ldapTest v;
|
||||||
|
|
||||||
|
"sso_${toString v}" = ssoTest v;
|
||||||
|
|
||||||
|
"prometheus_${toString v}" = prometheusTest v;
|
||||||
};
|
};
|
||||||
|
in
|
||||||
prometheus = shb.test.runNixOSTest {
|
lib.foldl (all: v: lib.mergeAttrs all (versionedTests v)) { } supportedVersion
|
||||||
name = "nextcloud_prometheus";
|
|
||||||
|
|
||||||
nodes.server =
|
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
basic
|
|
||||||
prometheus
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nodes.client = { };
|
|
||||||
|
|
||||||
testScript = prometheusTestScript;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue