at 23.11-pre 1.8 kB view raw
1{ 2 name = "adguardhome"; 3 4 nodes = { 5 nullConf = { ... }: { services.adguardhome = { enable = true; }; }; 6 7 emptyConf = { lib, ... }: { 8 services.adguardhome = { 9 enable = true; 10 settings = {}; 11 }; 12 }; 13 14 declarativeConf = { ... }: { 15 services.adguardhome = { 16 enable = true; 17 18 mutableSettings = false; 19 settings = { 20 schema_version = 0; 21 dns = { 22 bind_host = "0.0.0.0"; 23 bootstrap_dns = "127.0.0.1"; 24 }; 25 }; 26 }; 27 }; 28 29 mixedConf = { ... }: { 30 services.adguardhome = { 31 enable = true; 32 33 mutableSettings = true; 34 settings = { 35 schema_version = 0; 36 dns = { 37 bind_host = "0.0.0.0"; 38 bootstrap_dns = "127.0.0.1"; 39 }; 40 }; 41 }; 42 }; 43 }; 44 45 testScript = '' 46 with subtest("Minimal (settings = null) config test"): 47 nullConf.wait_for_unit("adguardhome.service") 48 49 with subtest("Default config test"): 50 emptyConf.wait_for_unit("adguardhome.service") 51 emptyConf.wait_for_open_port(3000) 52 53 with subtest("Declarative config test, DNS will be reachable"): 54 declarativeConf.wait_for_unit("adguardhome.service") 55 declarativeConf.wait_for_open_port(53) 56 declarativeConf.wait_for_open_port(3000) 57 58 with subtest("Mixed config test, check whether merging works"): 59 mixedConf.wait_for_unit("adguardhome.service") 60 mixedConf.wait_for_open_port(53) 61 mixedConf.wait_for_open_port(3000) 62 # Test whether merging works properly, even if nothing is changed 63 mixedConf.systemctl("restart adguardhome.service") 64 mixedConf.wait_for_unit("adguardhome.service") 65 mixedConf.wait_for_open_port(3000) 66 ''; 67}