add /ht/add-dns to jobs/check.php

This commit is contained in:
Miraty 2024-04-10 00:00:57 +02:00
parent 0496feb8fb
commit bae5170011
1 changed files with 50 additions and 2 deletions

View File

@ -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('#<code>(?<proof>' . preg_quote(CONF['common']['public_domains'][0], '#') . '_domain-verification=[0-9a-z-]{16,128})</code>#', 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', [