lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

nixosTests.acme-dns: migrate to runTest

Part Of #386873

+44 -47
+43 -46
nixos/tests/acme-dns.nix
··· 1 - import ./make-test-python.nix ( 2 - { ... }: 3 - { 4 - name = "acme-dns"; 1 + { 2 + name = "acme-dns"; 5 3 6 - nodes.machine = 7 - { pkgs, ... }: 8 - { 9 - services.acme-dns = { 10 - enable = true; 11 - settings = { 12 - general = rec { 13 - domain = "acme-dns.home.arpa"; 14 - nsname = domain; 15 - nsadmin = "admin.home.arpa"; 16 - records = [ 17 - "${domain}. A 127.0.0.1" 18 - "${domain}. AAAA ::1" 19 - "${domain}. NS ${domain}." 20 - ]; 21 - }; 22 - logconfig.loglevel = "debug"; 4 + nodes.machine = 5 + { pkgs, ... }: 6 + { 7 + services.acme-dns = { 8 + enable = true; 9 + settings = { 10 + general = rec { 11 + domain = "acme-dns.home.arpa"; 12 + nsname = domain; 13 + nsadmin = "admin.home.arpa"; 14 + records = [ 15 + "${domain}. A 127.0.0.1" 16 + "${domain}. AAAA ::1" 17 + "${domain}. NS ${domain}." 18 + ]; 23 19 }; 20 + logconfig.loglevel = "debug"; 24 21 }; 25 - environment.systemPackages = with pkgs; [ 26 - curl 27 - bind 28 - ]; 29 22 }; 23 + environment.systemPackages = with pkgs; [ 24 + curl 25 + bind 26 + ]; 27 + }; 30 28 31 - testScript = '' 32 - import json 29 + testScript = '' 30 + import json 33 31 34 - machine.wait_for_unit("acme-dns.service") 35 - machine.wait_for_open_port(53) # dns 36 - machine.wait_for_open_port(8080) # http api 32 + machine.wait_for_unit("acme-dns.service") 33 + machine.wait_for_open_port(53) # dns 34 + machine.wait_for_open_port(8080) # http api 37 35 38 - result = machine.succeed("curl --fail -X POST http://localhost:8080/register") 39 - print(result) 36 + result = machine.succeed("curl --fail -X POST http://localhost:8080/register") 37 + print(result) 40 38 41 - registration = json.loads(result) 39 + registration = json.loads(result) 42 40 43 - machine.succeed(f'dig -t TXT @localhost {registration["fulldomain"]} | grep "SOA" | grep "admin.home.arpa"') 41 + machine.succeed(f'dig -t TXT @localhost {registration["fulldomain"]} | grep "SOA" | grep "admin.home.arpa"') 44 42 45 - # acme-dns exspects a TXT value string length of exactly 43 chars 46 - txt = "___dummy_validation_token_for_txt_record___" 43 + # acme-dns exspects a TXT value string length of exactly 43 chars 44 + txt = "___dummy_validation_token_for_txt_record___" 47 45 48 - machine.succeed( 49 - "curl --fail -X POST http://localhost:8080/update " 50 - + f' -H "X-Api-User: {registration["username"]}"' 51 - + f' -H "X-Api-Key: {registration["password"]}"' 52 - + f' -d \'{{"subdomain":"{registration["subdomain"]}", "txt":"{txt}"}}\''' 53 - ) 46 + machine.succeed( 47 + "curl --fail -X POST http://localhost:8080/update " 48 + + f' -H "X-Api-User: {registration["username"]}"' 49 + + f' -H "X-Api-Key: {registration["password"]}"' 50 + + f' -d \'{{"subdomain":"{registration["subdomain"]}", "txt":"{txt}"}}\''' 51 + ) 54 52 55 - assert txt in machine.succeed(f'dig -t TXT +short @localhost {registration["fulldomain"]}') 56 - ''; 57 - } 58 - ) 53 + assert txt in machine.succeed(f'dig -t TXT +short @localhost {registration["fulldomain"]}') 54 + ''; 55 + }
+1 -1
nixos/tests/all-tests.nix
··· 147 147 _3proxy = runTest ./3proxy.nix; 148 148 aaaaxy = runTest ./aaaaxy.nix; 149 149 acme = import ./acme/default.nix { inherit runTest; }; 150 - acme-dns = handleTest ./acme-dns.nix {}; 150 + acme-dns = runTest ./acme-dns.nix; 151 151 actual = handleTest ./actual.nix {}; 152 152 adguardhome = runTest ./adguardhome.nix; 153 153 aesmd = runTestOn ["x86_64-linux"] ./aesmd.nix;