@@ -42,6 +42,7 @@ function validate_web_domain() {
4242 local domain=$2
4343 local webproof=$3
4444 local webpath=${4}
45+ local valwebpath=${5}
4546
4647 refute [ -z " $user " ]
4748 refute [ -z " $domain " ]
@@ -57,15 +58,16 @@ function validate_web_domain() {
5758 SSL=$( get_object_value ' web' ' DOMAIN' " $domain " ' $SSL' )
5859 domain_ip=$( get_real_ip " $domain_ip " )
5960
60- if [ ! -z $webpath ]; then
61- domain_docroot=$( get_object_value ' web' ' DOMAIN' " $domain " ' $CUSTOM_DOCROOT' )
62- if [ -n " $domain_docroot " ] && [ -d " $domain_docroot " ]; then
63- assert_file_exist " ${domain_docroot} /${webpath} "
64- else
65- assert_file_exist " ${HOMEDIR} /${user} /web/${domain} /public_html/${webpath} "
61+ if [ -z $valwebpath ]; then
62+ if [ ! -z $webpath ]; then
63+ domain_docroot=$( get_object_value ' web' ' DOMAIN' " $domain " ' $CUSTOM_DOCROOT' )
64+ if [ -n " $domain_docroot " ] && [ -d " $domain_docroot " ]; then
65+ assert_file_exist " ${domain_docroot} /${webpath} "
66+ else
67+ assert_file_exist " ${HOMEDIR} /${user} /web/${domain} /public_html/${webpath} "
68+ fi
6669 fi
6770 fi
68-
6971 # Test HTTP
7072 run curl --location --silent --show-error --insecure --resolve " ${domain} :80:${domain_ip} " " http://${domain} /${webpath} "
7173 assert_success
@@ -101,18 +103,24 @@ function validate_web_domain() {
101103# - hestia111_db
102104# cron:
103105# - 1: /bin/true
104- # Hestia 1.3.1 archive contains (As zstd format)
106+ # Hestia 1.7.0 archive contains (As zstd format)
105107# user: hestia131
106108# web:
107109# - test.hestia.com (+SSL self-signed)
110+ # FTP Account
111+ # Awstats enabled
108112# dns:
109113# - test.hestia.com
110114# mail:
111115# - test.hestia.com
116+ # Ratelimit: 10
112117# mail acc:
113118# - testaccount@test.hestia.com
119+ # Alias: info@test.hestiacp.com
120+ # Ratelimit: 20
121+ # - support@test.hestia.com
114122# db:
115- # - hestia131_db
123+ # - hestia170_db
116124# cron:
117125# - 1: /bin/true
118126# Vesta 0.9.8-23 archive contains:
@@ -275,7 +283,7 @@ function validate_web_domain() {
275283
276284 mkdir -p /backup
277285
278- local archive_name=" hestia131.2020-12-12 "
286+ local archive_name=" hestia170.2022-08-23 "
279287 run wget --quiet --tries=3 --timeout=15 --read-timeout=15 --waitretry=3 --no-dns-cache " https://hestiacp.com/testing/data/${archive_name} .tar" -O " /backup/${archive_name} .tar"
280288 assert_success
281289
@@ -290,6 +298,24 @@ function validate_web_domain() {
290298 validate_web_domain $userbk $domain ' Hello Hestia'
291299}
292300
301+ @test " Restore[3]: From Hestia [WEB] FTP" {
302+ local domain=" test.hestia.com"
303+ assert_file_contains /etc/passwd " $userbk_test "
304+ assert_file_contains /etc/passwd " /home/$userbk /web/$domain "
305+ }
306+
307+ @test " Restore[3]: From Hestia [WEB] Awstats" {
308+ local domain=" test.hestia.com"
309+ assert_file_exist /home/$userbk /conf/web/$domain /awstats.conf
310+ }
311+
312+ @test " Restore[3]: From Hestia [WEB] Custom rule" {
313+ # check if custom rule is still working
314+ local domain=" test.hestia.com"
315+ validate_web_domain $userbk $domain ' hestia-yes' ' /hestia/hestia' ' no'
316+ }
317+
318+
293319@test " Restore[3]: From Hestia [DNS]" {
294320 local domain=" test.hestia.com"
295321
@@ -312,6 +338,11 @@ function validate_web_domain() {
312338
313339 run v-list-mail-account $userbk $domain testaccount
314340 assert_success
341+ # Check if alias is created
342+ assert_file_contains /etc/exim4/domains/$domain /aliases " testaccount@$domain "
343+ # Check if expected rate limits are set
344+ assert_file_contains /etc/exim4/domains/$domain /limits " testaccount@$domain :20"
345+ assert_file_contains /etc/exim4/domains/$domain /limits " support@$domain :10"
315346}
316347
317348@test " Restore[3]: From Hestia [DB]" {
@@ -324,6 +355,7 @@ function validate_web_domain() {
324355 assert_success
325356}
326357
358+
327359@test " Restore[3]: From Hestia Cleanup" {
328360 run v-delete-user $userbk
329361 assert_success
@@ -344,7 +376,7 @@ function validate_web_domain() {
344376
345377 mkdir -p /backup
346378
347- local archive_name=" hestia131.2020-12-12 "
379+ local archive_name=" hestia170.2022-08-23 "
348380 run wget --quiet --tries=3 --timeout=15 --read-timeout=15 --waitretry=3 --no-dns-cache " https://hestiacp.com/testing/data/${archive_name} .tar" -O " /backup/${archive_name} .tar"
349381 assert_success
350382
@@ -359,6 +391,24 @@ function validate_web_domain() {
359391 validate_web_domain $userbk $domain ' Hello Hestia'
360392}
361393
394+ @test " Restore[4]: From Hestia [WEB] FTP" {
395+ local domain=" test.hestia.com"
396+ assert_file_contains /etc/passwd " $userbk_test "
397+ assert_file_contains /etc/passwd " /home/$userbk /web/$domain "
398+ }
399+
400+ @test " Restore[4]: From Hestia [WEB] Awstats" {
401+ local domain=" test.hestia.com"
402+ assert_file_exist /home/$userbk /conf/web/$domain /awstats.conf
403+ }
404+
405+ @test " Restore[4]: From Hestia [WEB] Custom rule" {
406+ # check if custom rule is still working
407+ local domain=" test.hestia.com"
408+ validate_web_domain $userbk $domain ' hestia-yes' ' /hestia/hestia' ' no'
409+ }
410+
411+
362412@test " Restore[4]: From Hestia [DNS]" {
363413 local domain=" test.hestia.com"
364414
@@ -381,6 +431,11 @@ function validate_web_domain() {
381431
382432 run v-list-mail-account $userbk $domain testaccount
383433 assert_success
434+ # Check if alias is created
435+ assert_file_contains /etc/exim4/domains/$domain /aliases " testaccount@$domain "
436+ # Check if expected rate limits are set
437+ assert_file_contains /etc/exim4/domains/$domain /limits " testaccount@$domain :20"
438+ assert_file_contains /etc/exim4/domains/$domain /limits " support@$domain :10"
384439}
385440
386441@test " Restore[4]: From Hestia [DB]" {
0 commit comments