From bae51700110fcc96ace4040da4a7303ea55b39c9 Mon Sep 17 00:00:00 2001 From: Miraty Date: Wed, 10 Apr 2024 00:00:57 +0200 Subject: [PATCH] add /ht/add-dns to jobs/check.php --- jobs/check.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/jobs/check.php b/jobs/check.php index 2e612d1..47b5545 100644 --- a/jobs/check.php +++ b/jobs/check.php @@ -246,7 +246,7 @@ function testNs(string $domain): void { } } -function testHt(string $username, string $password): void { +function testHt(string $username, string $password, string $domain): void { startTest('SFTP file upload'); define('TEST_CONTENT', 'test-' . bin2hex(random_bytes(16))); @@ -333,11 +333,59 @@ exit ]); stopTest(); } + + { + if (preg_match('#(?' . preg_quote(CONF['common']['public_domains'][0], '#') . '_domain-verification=[0-9a-z-]{16,128})#', curlTest('/ht/add-dns', []), $matches) !== 1) + exit('Can\'t find proof for dedicated site creation.' . LF); + + curlTest('/ns/sync', [ + 'syncs[0][source]' => CONF['ht']['cname'], + 'syncs[0][destination]' => $domain, + ]); + + curlTest('/ns/txt', [ + 'action' => 'add', + 'subdomain' => '_auth', + 'zone' => $domain, + 'ttl-value' => '1', + 'ttl-multiplier' => '300', + 'txt' => $matches['proof'], + ]); + + curlTest('/ns/caa', [ + 'action' => 'add', + 'subdomain' => '@', + 'zone' => $domain, + 'ttl-value' => '1', + 'ttl-multiplier' => '300', + 'flag' => '0', + 'tag' => 'issue', + 'value' => CONF['ht']['caa_account_uris']['testing'], + ]); + + startTest('dedicated site creation'); + curlTest('/ht/add-dns', [ + 'domain' => $domain, + 'dir' => '_site0-', + ]); + stopTest(); + + startTest('dedicated site reachability'); + if (curlTest('https://' . $domain . '/') !== TEST_CONTENT) + exit('Unexpected dedicated site response.' . LF); + stopTest(); + + startTest('dedicated site deletion'); + curlTest('/ht/del', [ + 'site' => 'dns:' . rtrim($domain, '.'), + ]); + stopTest(); + } } $domain = testReg(); testNs($domain); -testHt($username, $password); +testHt($username, $password, $domain); startTest('account deletion'); curlTest('/auth/unregister', [