test.bats 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257
  1. #!/usr/bin/env bats
  2. load 'test_helper/bats-support/load'
  3. load 'test_helper/bats-assert/load'
  4. load 'test_helper/bats-file/load'
  5. function random() {
  6. head /dev/urandom | tr -dc 0-9 | head -c$1
  7. }
  8. function setup() {
  9. # echo "# Setup_file" > &3
  10. if [ $BATS_TEST_NUMBER = 1 ]; then
  11. echo 'user=test-5285' > /tmp/hestia-test-env.sh
  12. echo 'userbk=testbk-5285' >> /tmp/hestia-test-env.sh
  13. echo 'userpass1=test-5285' >> /tmp/hestia-test-env.sh
  14. echo 'userpass2=t3st-p4ssw0rd' >> /tmp/hestia-test-env.sh
  15. echo 'HESTIA=/usr/local/hestia' >> /tmp/hestia-test-env.sh
  16. echo 'domain=test-5285.hestiacp.com' >> /tmp/hestia-test-env.sh
  17. fi
  18. source /tmp/hestia-test-env.sh
  19. source $HESTIA/func/main.sh
  20. source $HESTIA/conf/hestia.conf
  21. source $HESTIA/func/ip.sh
  22. }
  23. function validate_web_domain() {
  24. local user=$1
  25. local domain=$2
  26. local webproof=$3
  27. local webpath=${4}
  28. refute [ -z "$user" ]
  29. refute [ -z "$domain" ]
  30. refute [ -z "$webproof" ]
  31. source $HESTIA/func/ip.sh
  32. run v-list-web-domain $user $domain
  33. assert_success
  34. USER_DATA=$HESTIA/data/users/$user
  35. local domain_ip=$(get_object_value 'web' 'DOMAIN' "$domain" '$IP')
  36. SSL=$(get_object_value 'web' 'DOMAIN' "$domain" '$SSL')
  37. domain_ip=$(get_real_ip "$domain_ip")
  38. if [ ! -z $webpath ]; then
  39. domain_docroot=$(get_object_value 'web' 'DOMAIN' "$domain" '$CUSTOM_DOCROOT')
  40. if [ -n "$domain_docroot" ] && [ -d "$domain_docroot" ]; then
  41. assert_file_exist "${domain_docroot}/${webpath}"
  42. else
  43. assert_file_exist "${HOMEDIR}/${user}/web/${domain}/public_html/${webpath}"
  44. fi
  45. fi
  46. # Test HTTP
  47. run curl --location --silent --show-error --insecure --resolve "${domain}:80:${domain_ip}" "http://${domain}/${webpath}"
  48. assert_success
  49. assert_output --partial "$webproof"
  50. # Test HTTPS
  51. if [ "$SSL" = "yes" ]; then
  52. run v-list-web-domain-ssl $user $domain
  53. assert_success
  54. run curl --location --silent --show-error --insecure --resolve "${domain}:443:${domain_ip}" "https://${domain}/${webpath}"
  55. assert_success
  56. assert_output --partial "$webproof"
  57. fi
  58. }
  59. function validate_mail_domain() {
  60. local user=$1
  61. local domain=$2
  62. refute [ -z "$user" ]
  63. refute [ -z "$domain" ]
  64. run v-list-mail-domain $user $domain
  65. assert_success
  66. assert_dir_exist $HOMEDIR/$user/mail/$domain
  67. assert_dir_exist $HOMEDIR/$user/conf/mail/$domain
  68. assert_file_exist $HOMEDIR/$user/conf/mail/$domain/aliases
  69. assert_file_exist $HOMEDIR/$user/conf/mail/$domain/antispam
  70. assert_file_exist $HOMEDIR/$user/conf/mail/$domain/antivirus
  71. assert_file_exist $HOMEDIR/$user/conf/mail/$domain/fwd_only
  72. assert_file_exist $HOMEDIR/$user/conf/mail/$domain/ip
  73. assert_file_exist $HOMEDIR/$user/conf/mail/$domain/passwd
  74. }
  75. function validate_webmail_domain() {
  76. local user=$1
  77. local domain=$2
  78. local webproof=$3
  79. local webpath=${4}
  80. refute [ -z "$user" ]
  81. refute [ -z "$domain" ]
  82. refute [ -z "$webproof" ]
  83. source $HESTIA/func/ip.sh
  84. USER_DATA=$HESTIA/data/users/$user
  85. local domain_ip=$(get_object_value 'web' 'DOMAIN' "$domain" '$IP')
  86. SSL=$(get_object_value 'mail' 'DOMAIN' "$domain" '$SSL')
  87. domain_ip=$(get_real_ip "$domain_ip")
  88. if [ ! -z "$webpath" ]; then
  89. assert_file_exist /var/lib/roundcube/$webpath
  90. fi
  91. # Test HTTP
  92. run curl --location --silent --show-error --insecure --resolve "webmail.${domain}:80:${domain_ip}" "http://webmail.${domain}/${webpath}"
  93. assert_success
  94. assert_output --partial "$webproof"
  95. # Test HTTP
  96. run curl --location --silent --show-error --insecure --resolve "mail.${domain}:80:${domain_ip}" "http://mail.${domain}/${webpath}"
  97. assert_success
  98. assert_output --partial "$webproof"
  99. # Test HTTPS
  100. if [ "$SSL" = "yes" ]; then
  101. run v-list-mail-domain-ssl $user $domain
  102. assert_success
  103. run curl --location --silent --show-error --insecure --resolve "webmail.${domain}:443:${domain_ip}" "https://webmail.${domain}/${webpath}"
  104. assert_success
  105. assert_output --partial "$webproof"
  106. run curl --location --silent --show-error --insecure --resolve "mail.${domain}:443:${domain_ip}" "https://mail.${domain}/${webpath}"
  107. assert_success
  108. assert_output --partial "$webproof"
  109. fi
  110. }
  111. #----------------------------------------------------------#
  112. # MAIN #
  113. #----------------------------------------------------------#
  114. @test "Add new userXXX" {
  115. skip
  116. run v-add-user $user $user [email protected] default "Super Test"
  117. assert_success
  118. refute_output
  119. }
  120. #----------------------------------------------------------#
  121. # IP #
  122. #----------------------------------------------------------#
  123. @test "Check reverse Dns validation" {
  124. # 1. PTR record for a IP should return a hostname(reverse) which in turn must resolve to the same IP addr(forward). (Full circle)
  125. # `-> not implemented in `is_ip_rdns_valid` yet and also not tested here
  126. # 2. Reject rPTR records that match generic dynamic IP pool patterns
  127. local ip="54.200.1.22"
  128. local rdns="ec2-54-200-1-22.us-west-2.compute.amazonaws.com"
  129. run is_ip_rdns_valid "$ip"
  130. assert_failure
  131. refute_output
  132. local rdns="ec2.54.200.1.22.us-west-2.compute.amazonaws.com"
  133. run is_ip_rdns_valid "$ip"
  134. assert_failure
  135. refute_output
  136. local rdns="ec2-22-1-200-54.us-west-2.compute.amazonaws.com"
  137. run is_ip_rdns_valid "$ip"
  138. assert_failure
  139. refute_output
  140. local rdns="ec2.22.1.200.54.us-west-2.compute.amazonaws.com"
  141. run is_ip_rdns_valid "$ip"
  142. assert_failure
  143. refute_output
  144. local rdns="ec2-200-54-1-22.us-west-2.compute.amazonaws.com"
  145. run is_ip_rdns_valid "$ip"
  146. assert_failure
  147. refute_output
  148. local rdns="panel-22.mydomain.tld"
  149. run is_ip_rdns_valid "$ip"
  150. assert_success
  151. assert_output "$rdns"
  152. local rdns="mail.mydomain.tld"
  153. run is_ip_rdns_valid "$ip"
  154. assert_success
  155. assert_output "$rdns"
  156. local rdns="mydomain.tld"
  157. run is_ip_rdns_valid "$ip"
  158. assert_success
  159. assert_output "$rdns"
  160. }
  161. #----------------------------------------------------------#
  162. # User #
  163. #----------------------------------------------------------#
  164. @test "Add new user" {
  165. run v-add-user $user $user [email protected] default "Super Test"
  166. assert_success
  167. refute_output
  168. }
  169. @test "Change user password" {
  170. run v-change-user-password "$user" t3st-p4ssw0rd
  171. assert_success
  172. refute_output
  173. }
  174. @test "Change user email" {
  175. run v-change-user-contact "$user" [email protected]
  176. assert_success
  177. refute_output
  178. }
  179. @test "Change user contact invalid email " {
  180. run v-change-user-contact "$user" testerhestiacp.com
  181. assert_failure $E_INVALID
  182. assert_output --partial 'Error: invalid email format'
  183. }
  184. @test "Change user name" {
  185. run v-change-user-name "$user" "New name"
  186. assert_success
  187. refute_output
  188. }
  189. @test "Change user shell" {
  190. run v-change-user-shell $user bash
  191. assert_success
  192. refute_output
  193. }
  194. @test "Change user invalid shell" {
  195. run v-change-user-shell $user bashinvalid
  196. assert_failure $E_INVALID
  197. assert_output --partial 'shell bashinvalid is not valid'
  198. }
  199. @test "Change user default ns" {
  200. run v-change-user-ns $user ns0.com ns1.com ns2.com ns3.com
  201. assert_success
  202. refute_output
  203. run v-list-user-ns "$user" plain
  204. assert_success
  205. assert_output --partial 'ns0.com'
  206. }
  207. #----------------------------------------------------------#
  208. # Cron #
  209. #----------------------------------------------------------#
  210. @test "Cron: Add cron job" {
  211. run v-add-cron-job $user 1 1 1 1 1 echo
  212. assert_success
  213. refute_output
  214. }
  215. @test "Cron: Suspend cron job" {
  216. run v-suspend-cron-job $user 1
  217. assert_success
  218. refute_output
  219. }
  220. @test "Cron: Unsuspend cron job" {
  221. run v-unsuspend-cron-job $user 1
  222. assert_success
  223. refute_output
  224. }
  225. @test "Cron: Delete cron job" {
  226. run v-delete-cron-job $user 1
  227. assert_success
  228. refute_output
  229. }
  230. @test "Cron: Add cron job (duplicate)" {
  231. run v-add-cron-job $user 1 1 1 1 1 echo 1
  232. assert_success
  233. refute_output
  234. run v-add-cron-job $user 1 1 1 1 1 echo 1
  235. assert_failure $E_EXISTS
  236. assert_output --partial 'JOB=1 is already exists'
  237. }
  238. @test "Cron: Second cron job" {
  239. run v-add-cron-job $user 2 2 2 2 2 echo 2
  240. assert_success
  241. refute_output
  242. }
  243. @test "Cron: Two cron jobs must be listed" {
  244. run v-list-cron-jobs $user csv
  245. assert_success
  246. assert_line --partial '1,1,1,1,1,"echo",no'
  247. assert_line --partial '2,2,2,2,2,"echo",no'
  248. }
  249. @test "Cron: rebuild" {
  250. run v-rebuild-cron-jobs $user
  251. assert_success
  252. refute_output
  253. }
  254. #----------------------------------------------------------#
  255. # IP #
  256. #----------------------------------------------------------#
  257. @test "Ip: Add new ip on first interface" {
  258. interface=$(v-list-sys-interfaces plain | head -n 1)
  259. run ip link show dev $interface
  260. assert_success
  261. local a2_rpaf="/etc/$WEB_SYSTEM/mods-enabled/rpaf.conf"
  262. local a2_remoteip="/etc/$WEB_SYSTEM/mods-enabled/remoteip.conf"
  263. # Save initial state
  264. echo "interface=${interface}" >> /tmp/hestia-test-env.sh
  265. [ -f "$a2_rpaf" ] && file_hash1=$(cat $a2_rpaf |md5sum |cut -d" " -f1) && echo "a2_rpaf_hash='${file_hash1}'" >> /tmp/hestia-test-env.sh
  266. [ -f "$a2_remoteip" ] && file_hash2=$(cat $a2_remoteip |md5sum |cut -d" " -f1) && echo "a2_remoteip_hash='${file_hash2}'" >> /tmp/hestia-test-env.sh
  267. local ip="198.18.0.12"
  268. run v-add-sys-ip $ip 255.255.255.255 $interface $user
  269. assert_success
  270. refute_output
  271. assert_file_exist /etc/$WEB_SYSTEM/conf.d/$ip.conf
  272. assert_file_exist $HESTIA/data/ips/$ip
  273. assert_file_contains $HESTIA/data/ips/$ip "OWNER='$user'"
  274. assert_file_contains $HESTIA/data/ips/$ip "INTERFACE='$interface'"
  275. if [ -n "$PROXY_SYSTEM" ]; then
  276. assert_file_exist /etc/$PROXY_SYSTEM/conf.d/$ip.conf
  277. [ -f "$a2_rpaf" ] && assert_file_contains "$a2_rpaf" "RPAFproxy_ips.*$ip\b"
  278. [ -f "$a2_remoteip" ] && assert_file_contains "$a2_remoteip" "RemoteIPInternalProxy $ip\$"
  279. fi
  280. }
  281. @test "Ip: Add ip (duplicate)" {
  282. run v-add-sys-ip 198.18.0.12 255.255.255.255 $interface $user
  283. assert_failure $E_EXISTS
  284. }
  285. @test "Ip: Add extra ip" {
  286. local ip="198.18.0.121"
  287. run v-add-sys-ip $ip 255.255.255.255 $interface $user
  288. assert_success
  289. refute_output
  290. assert_file_exist /etc/$WEB_SYSTEM/conf.d/$ip.conf
  291. assert_file_exist $HESTIA/data/ips/$ip
  292. assert_file_contains $HESTIA/data/ips/$ip "OWNER='$user'"
  293. assert_file_contains $HESTIA/data/ips/$ip "INTERFACE='$interface'"
  294. if [ -n "$PROXY_SYSTEM" ]; then
  295. assert_file_exist /etc/$PROXY_SYSTEM/conf.d/$ip.conf
  296. local a2_rpaf="/etc/$WEB_SYSTEM/mods-enabled/rpaf.conf"
  297. [ -f "$a2_rpaf" ] && assert_file_contains "$a2_rpaf" "RPAFproxy_ips.*$ip\b"
  298. local a2_remoteip="/etc/$WEB_SYSTEM/mods-enabled/remoteip.conf"
  299. [ -f "$a2_remoteip" ] && assert_file_contains "$a2_remoteip" "RemoteIPInternalProxy $ip\$"
  300. fi
  301. }
  302. @test "Ip: Delete ips" {
  303. local ip="198.18.0.12"
  304. run v-delete-sys-ip $ip
  305. assert_success
  306. refute_output
  307. assert_file_not_exist /etc/$WEB_SYSTEM/conf.d/$ip.conf
  308. assert_file_not_exist $HESTIA/data/ips/$ip
  309. ip="198.18.0.121"
  310. run v-delete-sys-ip $ip
  311. assert_success
  312. refute_output
  313. assert_file_not_exist /etc/$WEB_SYSTEM/conf.d/$ip.conf
  314. assert_file_not_exist $HESTIA/data/ips/$ip
  315. if [ -n "$PROXY_SYSTEM" ]; then
  316. assert_file_not_exist /etc/$PROXY_SYSTEM/conf.d/$ip.conf
  317. fi
  318. # remoteip and rpaf config hashes must match the initial one
  319. if [ ! -z "$a2_rpaf_hash" ]; then
  320. local a2_rpaf="/etc/$WEB_SYSTEM/mods-enabled/rpaf.conf"
  321. file_hash=$(cat $a2_rpaf |md5sum |cut -d" " -f1)
  322. assert_equal "$file_hash" "$a2_rpaf_hash"
  323. fi
  324. if [ ! -z "$a2_remoteip_hash" ]; then
  325. local a2_remoteip="/etc/$WEB_SYSTEM/mods-enabled/remoteip.conf"
  326. file_hash=$(cat $a2_remoteip |md5sum |cut -d" " -f1)
  327. assert_equal "$file_hash" "$a2_remoteip_hash"
  328. fi
  329. }
  330. @test "Ip: Add IP for rest of the test" {
  331. local ip="198.18.0.125"
  332. run v-add-sys-ip $ip 255.255.255.255 $interface $user
  333. assert_success
  334. refute_output
  335. assert_file_exist /etc/$WEB_SYSTEM/conf.d/$ip.conf
  336. assert_file_exist $HESTIA/data/ips/$ip
  337. assert_file_contains $HESTIA/data/ips/$ip "OWNER='$user'"
  338. assert_file_contains $HESTIA/data/ips/$ip "INTERFACE='$interface'"
  339. if [ -n "$PROXY_SYSTEM" ]; then
  340. assert_file_exist /etc/$PROXY_SYSTEM/conf.d/$ip.conf
  341. local a2_rpaf="/etc/$WEB_SYSTEM/mods-enabled/rpaf.conf"
  342. [ -f "$a2_rpaf" ] && assert_file_contains "$a2_rpaf" "RPAFproxy_ips.*$ip\b"
  343. local a2_remoteip="/etc/$WEB_SYSTEM/mods-enabled/remoteip.conf"
  344. [ -f "$a2_remoteip" ] && assert_file_contains "$a2_remoteip" "RemoteIPInternalProxy $ip\$"
  345. fi
  346. }
  347. #----------------------------------------------------------#
  348. # WEB #
  349. #----------------------------------------------------------#
  350. @test "WEB: Add web domain" {
  351. run v-add-web-domain $user $domain 198.18.0.125
  352. assert_success
  353. refute_output
  354. echo -e "<?php\necho 'Hestia Test:'.(4*3);" > $HOMEDIR/$user/web/$domain/public_html/php-test.php
  355. validate_web_domain $user $domain 'Hestia Test:12' 'php-test.php'
  356. rm $HOMEDIR/$user/web/$domain/public_html/php-test.php
  357. }
  358. @test "WEB: Add web domain (duplicate)" {
  359. run v-add-web-domain $user $domain 198.18.0.125
  360. assert_failure $E_EXISTS
  361. }
  362. @test "WEB: Add web domain alias" {
  363. run v-add-web-domain-alias $user $domain v3.$domain
  364. assert_success
  365. refute_output
  366. }
  367. @test "WEB: Add web domain alias (duplicate)" {
  368. run v-add-web-domain-alias $user $domain v3.$domain
  369. assert_failure $E_EXISTS
  370. }
  371. @test "WEB: Add web domain stats" {
  372. run v-add-web-domain-stats $user $domain awstats
  373. assert_success
  374. refute_output
  375. }
  376. @test "WEB: Add web domain stats user" {
  377. skip
  378. run v-add-web-domain-stats-user $user $domain test m3g4p4ssw0rd
  379. assert_success
  380. refute_output
  381. }
  382. @test "WEB: Suspend web domain" {
  383. run v-suspend-web-domain $user $domain
  384. assert_success
  385. refute_output
  386. validate_web_domain $user $domain 'This site is currently suspended'
  387. }
  388. @test "WEB: Unsuspend web domain" {
  389. run v-unsuspend-web-domain $user $domain
  390. assert_success
  391. refute_output
  392. echo -e "<?php\necho 'Hestia Test:'.(4*3);" > $HOMEDIR/$user/web/$domain/public_html/php-test.php
  393. validate_web_domain $user $domain 'Hestia Test:12' 'php-test.php'
  394. rm $HOMEDIR/$user/web/$domain/public_html/php-test.php
  395. }
  396. @test "WEB: Add ssl" {
  397. cp -f $HESTIA/ssl/certificate.crt /tmp/$domain.crt
  398. cp -f $HESTIA/ssl/certificate.key /tmp/$domain.key
  399. run v-add-web-domain-ssl $user $domain /tmp
  400. assert_success
  401. refute_output
  402. }
  403. @test "WEB: Rebuild web domain" {
  404. run v-rebuild-web-domains $user
  405. assert_success
  406. refute_output
  407. }
  408. #----------------------------------------------------------#
  409. # MULTIPHP #
  410. #----------------------------------------------------------#
  411. @test "Multiphp: Default php Backend version" {
  412. def_phpver=$(multiphp_default_version)
  413. multi_domain="multiphp.${domain}"
  414. run v-add-web-domain $user $multi_domain 198.18.0.125
  415. assert_success
  416. refute_output
  417. echo -e "<?php\necho PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  418. validate_web_domain $user $multi_domain "$def_phpver" 'php-test.php'
  419. rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  420. }
  421. @test "Multiphp: Change backend version - PHP v5.6" {
  422. test_phpver='5.6'
  423. multi_domain="multiphp.${domain}"
  424. if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
  425. skip "PHP ${test_phpver} not installed"
  426. fi
  427. run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-5_6' 'yes'
  428. assert_success
  429. refute_output
  430. # Changing web backend will create a php-fpm pool config in the corresponding php folder
  431. assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
  432. # A single php-fpm pool config file must be present
  433. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  434. assert_equal "$num_fpm_config_files" '1'
  435. echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  436. validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
  437. rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  438. }
  439. @test "Multiphp: Change backend version - PHP v7.0" {
  440. test_phpver='7.0'
  441. multi_domain="multiphp.${domain}"
  442. if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
  443. skip "PHP ${test_phpver} not installed"
  444. fi
  445. run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_0' 'yes'
  446. assert_success
  447. refute_output
  448. # Changing web backend will create a php-fpm pool config in the corresponding php folder
  449. assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
  450. # A single php-fpm pool config file must be present
  451. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  452. assert_equal "$num_fpm_config_files" '1'
  453. echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  454. validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
  455. rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  456. }
  457. @test "Multiphp: Change backend version - PHP v7.1" {
  458. test_phpver='7.1'
  459. multi_domain="multiphp.${domain}"
  460. if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
  461. skip "PHP ${test_phpver} not installed"
  462. fi
  463. run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_1' 'yes'
  464. assert_success
  465. refute_output
  466. # Changing web backend will create a php-fpm pool config in the corresponding php folder
  467. assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
  468. # A single php-fpm pool config file must be present
  469. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  470. assert_equal "$num_fpm_config_files" '1'
  471. echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  472. validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
  473. rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  474. }
  475. @test "Multiphp: Change backend version - PHP v7.2" {
  476. test_phpver='7.2'
  477. multi_domain="multiphp.${domain}"
  478. if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
  479. skip "PHP ${test_phpver} not installed"
  480. fi
  481. run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_2' 'yes'
  482. assert_success
  483. refute_output
  484. # Changing web backend will create a php-fpm pool config in the corresponding php folder
  485. assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
  486. # A single php-fpm pool config file must be present
  487. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  488. assert_equal "$num_fpm_config_files" '1'
  489. echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  490. validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
  491. rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  492. }
  493. @test "Multiphp: Change backend version - PHP v7.3" {
  494. test_phpver='7.3'
  495. multi_domain="multiphp.${domain}"
  496. if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
  497. skip "PHP ${test_phpver} not installed"
  498. fi
  499. run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_3' 'yes'
  500. assert_success
  501. refute_output
  502. # Changing web backend will create a php-fpm pool config in the corresponding php folder
  503. assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
  504. # A single php-fpm pool config file must be present
  505. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  506. assert_equal "$num_fpm_config_files" '1'
  507. echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  508. validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
  509. rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  510. }
  511. @test "Multiphp: Change backend version - PHP v7.4" {
  512. test_phpver='7.4'
  513. multi_domain="multiphp.${domain}"
  514. if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
  515. skip "PHP ${test_phpver} not installed"
  516. fi
  517. run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_4' 'yes'
  518. assert_success
  519. refute_output
  520. # Changing web backend will create a php-fpm pool config in the corresponding php folder
  521. assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
  522. # A single php-fpm pool config file must be present
  523. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  524. assert_equal "$num_fpm_config_files" '1'
  525. echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  526. validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
  527. rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  528. }
  529. @test "Multiphp: Change backend version - PHP v8.0" {
  530. test_phpver='8.0'
  531. multi_domain="multiphp.${domain}"
  532. if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
  533. skip "PHP ${test_phpver} not installed"
  534. fi
  535. run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-8_0' 'yes'
  536. assert_success
  537. refute_output
  538. # Changing web backend will create a php-fpm pool config in the corresponding php folder
  539. assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
  540. # A single php-fpm pool config file must be present
  541. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  542. assert_equal "$num_fpm_config_files" '1'
  543. echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
  544. validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
  545. rm $HOMEDIR/$user/web/$multi_domain/public_html/php-test.php
  546. }
  547. @test "Multiphp: Cleanup" {
  548. multi_domain="multiphp.${domain}"
  549. run v-delete-web-domain $user $multi_domain 'yes'
  550. assert_success
  551. refute_output
  552. # No php-fpm pool config file must be present
  553. num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
  554. assert_equal "$num_fpm_config_files" '0'
  555. }
  556. #----------------------------------------------------------#
  557. # CUSTOM DOCROOT #
  558. #----------------------------------------------------------#
  559. @test "Docroot: Self Subfolder" {
  560. docroot1_domain="docroot1.${domain}"
  561. run v-add-web-domain $user $docroot1_domain 198.18.0.125
  562. assert_success
  563. refute_output
  564. run v-add-fs-directory $user "$HOMEDIR/$user/web/$docroot1_domain/public_html/public/"
  565. assert_success
  566. refute_output
  567. run v-change-web-domain-docroot $user "$docroot1_domain" "$docroot1_domain" "/public"
  568. assert_success
  569. refute_output
  570. echo -e '<?php\necho "self-sub-".$_SERVER["HTTP_HOST"];' > "$HOMEDIR/$user/web/$docroot1_domain/public_html/public/php-test.php"
  571. validate_web_domain $user $docroot1_domain "self-sub-${docroot1_domain}" 'php-test.php'
  572. rm "$HOMEDIR/$user/web/$docroot1_domain/public_html/public/php-test.php"
  573. }
  574. @test "Docroot: Other domain subfolder" {
  575. docroot1_domain="docroot1.${domain}"
  576. docroot2_domain="docroot2.${domain}"
  577. run v-add-web-domain $user $docroot2_domain 198.18.0.125
  578. assert_success
  579. refute_output
  580. run v-add-fs-directory $user "$HOMEDIR/$user/web/$docroot2_domain/public_html/public/"
  581. assert_success
  582. refute_output
  583. run v-change-web-domain-docroot $user "$docroot1_domain" "$docroot2_domain" "/public"
  584. assert_success
  585. refute_output
  586. echo -e '<?php\necho "doc2-sub-".$_SERVER["HTTP_HOST"];' > "$HOMEDIR/$user/web/$docroot2_domain/public_html/public/php-test.php"
  587. validate_web_domain $user $docroot1_domain "doc2-sub-${docroot1_domain}" 'php-test.php'
  588. rm "$HOMEDIR/$user/web/$docroot2_domain/public_html/public/php-test.php"
  589. }
  590. @test "Docroot: Other domain root folder" {
  591. docroot1_domain="docroot1.${domain}"
  592. docroot2_domain="docroot2.${domain}"
  593. run v-change-web-domain-docroot $user "$docroot1_domain" "$docroot2_domain"
  594. assert_success
  595. refute_output
  596. echo -e '<?php\necho "doc2-root-".$_SERVER["HTTP_HOST"];' > "$HOMEDIR/$user/web/$docroot2_domain/public_html/php-test.php"
  597. validate_web_domain $user $docroot1_domain "doc2-root-${docroot1_domain}" 'php-test.php'
  598. rm "$HOMEDIR/$user/web/$docroot2_domain/public_html/php-test.php"
  599. }
  600. @test "Docroot: Reset" {
  601. docroot1_domain="docroot1.${domain}"
  602. run v-change-web-domain-docroot $user "$docroot1_domain" "default"
  603. assert_success
  604. refute_output
  605. echo -e '<?php\necho "doc1-root-".$_SERVER["HTTP_HOST"];' > "$HOMEDIR/$user/web/$docroot1_domain/public_html/php-test.php"
  606. validate_web_domain $user $docroot1_domain "doc1-root-${docroot1_domain}" 'php-test.php'
  607. rm "$HOMEDIR/$user/web/$docroot1_domain/public_html/php-test.php"
  608. }
  609. @test "Docroot: Cleanup" {
  610. docroot1_domain="docroot1.${domain}"
  611. docroot2_domain="docroot2.${domain}"
  612. run v-delete-web-domain $user $docroot1_domain
  613. assert_success
  614. refute_output
  615. run v-delete-web-domain $user $docroot2_domain
  616. assert_success
  617. refute_output
  618. }
  619. #----------------------------------------------------------#
  620. # DNS #
  621. #----------------------------------------------------------#
  622. @test "DNS: Add domain" {
  623. run v-add-dns-domain $user $domain 198.18.0.125
  624. assert_success
  625. refute_output
  626. }
  627. @test "DNS: Add domain (duplicate)" {
  628. run v-add-dns-domain $user $domain 198.18.0.125
  629. assert_failure $E_EXISTS
  630. }
  631. @test "DNS: Add domain record" {
  632. run v-add-dns-record $user $domain test A 198.18.0.125 20
  633. assert_success
  634. refute_output
  635. }
  636. @test "DNS: Delete domain record" {
  637. run v-delete-dns-record $user $domain 20
  638. assert_success
  639. refute_output
  640. }
  641. @test "DNS: Delete missing domain record" {
  642. run v-delete-dns-record $user $domain 20
  643. assert_failure $E_NOTEXIST
  644. }
  645. @test "DNS: Change domain expire date" {
  646. run v-change-dns-domain-exp $user $domain 2020-01-01
  647. assert_success
  648. refute_output
  649. }
  650. @test "DNS: Change domain ip" {
  651. run v-change-dns-domain-ip $user $domain 127.0.0.1
  652. assert_success
  653. refute_output
  654. }
  655. @test "DNS: Suspend domain" {
  656. run v-suspend-dns-domain $user $domain
  657. assert_success
  658. refute_output
  659. }
  660. @test "DNS: Unsuspend domain" {
  661. run v-unsuspend-dns-domain $user $domain
  662. assert_success
  663. refute_output
  664. }
  665. @test "DNS: Rebuild" {
  666. run v-rebuild-dns-domains $user
  667. assert_success
  668. refute_output
  669. }
  670. #----------------------------------------------------------#
  671. # MAIL #
  672. #----------------------------------------------------------#
  673. @test "MAIL: Add domain" {
  674. run v-add-mail-domain $user $domain
  675. assert_success
  676. refute_output
  677. validate_mail_domain $user $domain
  678. # echo -e "<?php\necho 'Server: ' . \$_SERVER['SERVER_SOFTWARE'];" > /var/lib/roundcube/check_server.php
  679. validate_webmail_domain $user $domain 'Welcome to Roundcube Webmail'
  680. # rm /var/lib/roundcube/check_server.php
  681. }
  682. @test "MAIL: Add domain (duplicate)" {
  683. run v-add-mail-domain $user $domain
  684. assert_failure $E_EXISTS
  685. }
  686. @test "MAIL: Add account" {
  687. run v-add-mail-account $user $domain test t3st-p4ssw0rd
  688. assert_success
  689. refute_output
  690. }
  691. @test "MAIL: Add account (duplicate)" {
  692. run v-add-mail-account $user $domain test t3st-p4ssw0rd
  693. assert_failure $E_EXISTS
  694. }
  695. @test "MAIL: Delete account" {
  696. run v-delete-mail-account $user $domain test
  697. assert_success
  698. refute_output
  699. }
  700. @test "MAIL: Delete missing account" {
  701. run v-delete-mail-account $user $domain test
  702. assert_failure $E_NOTEXIST
  703. }
  704. #----------------------------------------------------------#
  705. # DB #
  706. #----------------------------------------------------------#
  707. #----------------------------------------------------------#
  708. # Backup / Restore #
  709. #----------------------------------------------------------#
  710. #Test backup
  711. # Hestia v1.1.1 archive contains:
  712. # user: hestia111
  713. # web:
  714. # - test.hestia.com (+SSL self-signed)
  715. # dns:
  716. # - test.hestia.com
  717. # mail:
  718. # - test.hestia.com
  719. # mail acc:
  720. # - [email protected]
  721. # db:
  722. # - hestia111_db
  723. # cron:
  724. # - 1: /bin/true
  725. #
  726. # Vesta 0.9.8-23 archive contains:
  727. # user: vesta09823
  728. # web:
  729. # - vesta09823.tld (+SSL self-signed)
  730. # dns:
  731. # - vesta09823.tld
  732. # mail:
  733. # - vesta09823.tld
  734. # mail acc:
  735. # - [email protected]
  736. # db:
  737. # - vesta09823_db
  738. # cron:
  739. # - 1: /bin/true
  740. #
  741. # Testing Hestia backups
  742. @test "Restore[1]: Hestia archive for a non-existing user" {
  743. if [ -d "$HOMEDIR/$userbk" ]; then
  744. run v-delete-user $userbk
  745. assert_success
  746. refute_output
  747. fi
  748. mkdir -p /backup
  749. local archive_name="hestia111.2020-03-26"
  750. 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"
  751. assert_success
  752. run v-restore-user $userbk "${archive_name}.tar"
  753. assert_success
  754. rm "/backup/${archive_name}.tar"
  755. }
  756. @test "Restore[1]: From Hestia [WEB]" {
  757. local domain="test.hestia.com"
  758. validate_web_domain $userbk $domain 'Hello Hestia'
  759. }
  760. @test "Restore[1]: From Hestia [DNS]" {
  761. local domain="test.hestia.com"
  762. run v-list-dns-domain $userbk $domain
  763. assert_success
  764. run nslookup $domain 127.0.0.1
  765. assert_success
  766. }
  767. @test "Restore[1]: From Hestia [MAIL]" {
  768. local domain="test.hestia.com"
  769. run v-list-mail-domain $userbk $domain
  770. assert_success
  771. }
  772. @test "Restore[1]: From Hestia [MAIL-Account]" {
  773. local domain="test.hestia.com"
  774. run v-list-mail-account $userbk $domain testaccount
  775. assert_success
  776. }
  777. @test "Restore[1]: From Hestia [DB]" {
  778. run v-list-database $userbk "${userbk}_db"
  779. assert_success
  780. }
  781. @test "Restore[1]: From Hestia [CRON]" {
  782. run v-list-cron-job $userbk 1
  783. assert_success
  784. }
  785. @test "Restore[1]: From Hestia Cleanup" {
  786. run v-delete-user $userbk
  787. assert_success
  788. refute_output
  789. }
  790. @test "Restore[2]: Hestia archive over a existing user" {
  791. if [ -d "$HOMEDIR/$userbk" ]; then
  792. run v-delete-user $userbk
  793. assert_success
  794. refute_output
  795. fi
  796. if [ ! -d "$HOMEDIR/$userbk" ]; then
  797. run v-add-user $userbk $userbk [email protected]
  798. assert_success
  799. fi
  800. mkdir -p /backup
  801. local archive_name="hestia111.2020-03-26"
  802. 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"
  803. assert_success
  804. run v-restore-user $userbk "${archive_name}.tar"
  805. assert_success
  806. rm "/backup/${archive_name}.tar"
  807. }
  808. @test "Restore[2]: From Hestia [WEB]" {
  809. local domain="test.hestia.com"
  810. validate_web_domain $userbk "${domain}" 'Hello Hestia'
  811. }
  812. @test "Restore[2]: From Hestia [DNS]" {
  813. local domain="test.hestia.com"
  814. run v-list-dns-domain $userbk $domain
  815. assert_success
  816. run nslookup $domain 127.0.0.1
  817. assert_success
  818. }
  819. @test "Restore[2]: From Hestia [MAIL]" {
  820. local domain="test.hestia.com"
  821. run v-list-mail-domain $userbk $domain
  822. assert_success
  823. }
  824. @test "Restore[2]: From Hestia [MAIL-Account]" {
  825. local domain="test.hestia.com"
  826. run v-list-mail-account $userbk $domain testaccount
  827. assert_success
  828. }
  829. @test "Restore[2]: From Hestia [DB]" {
  830. run v-list-database $userbk "${userbk}_db"
  831. assert_success
  832. }
  833. @test "Restore[2]: From Hestia [CRON]" {
  834. run v-list-cron-job $userbk 1
  835. assert_success
  836. }
  837. @test "Restore[2]: From Hestia Cleanup" {
  838. run v-delete-user $userbk
  839. assert_success
  840. refute_output
  841. }
  842. # Testing Vesta Backups
  843. @test "Restore[1]: Vesta archive for a non-existing user" {
  844. if [ -d "$HOMEDIR/$userbk" ]; then
  845. run v-delete-user $userbk
  846. assert_success
  847. refute_output
  848. fi
  849. mkdir -p /backup
  850. local archive_name="vesta09823.2018-10-18"
  851. 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"
  852. assert_success
  853. run v-restore-user $userbk "${archive_name}.tar"
  854. assert_success
  855. rm "/backup/${archive_name}.tar"
  856. }
  857. @test "Restore[1]: From Vesta [WEB]" {
  858. local domain="vesta09823.tld"
  859. validate_web_domain $userbk $domain 'Hello Vesta'
  860. }
  861. @test "Restore[1]: From Vesta [DNS]" {
  862. local domain="vesta09823.tld"
  863. run v-list-dns-domain $userbk $domain
  864. assert_success
  865. run nslookup $domain 127.0.0.1
  866. assert_success
  867. }
  868. @test "Restore[1]: From Vesta [MAIL]" {
  869. local domain="vesta09823.tld"
  870. run v-list-mail-domain $userbk $domain
  871. assert_success
  872. }
  873. @test "Restore[1]: From Vesta [MAIL-Account]" {
  874. local domain="vesta09823.tld"
  875. run v-list-mail-account $userbk $domain testaccount
  876. assert_success
  877. }
  878. @test "Restore[1]: From Vesta [DB]" {
  879. run v-list-database $userbk "${userbk}_db"
  880. assert_success
  881. }
  882. @test "Restore[1]: From Vesta [CRON]" {
  883. run v-list-cron-job $userbk 1
  884. assert_success
  885. }
  886. @test "Restore[1]: From Vesta Cleanup" {
  887. run v-delete-user $userbk
  888. assert_success
  889. refute_output
  890. }
  891. @test "Restore[2]: Vesta archive over a existing user" {
  892. if [ -d "$HOMEDIR/$userbk" ]; then
  893. run v-delete-user $userbk
  894. assert_success
  895. refute_output
  896. fi
  897. if [ ! -d "$HOMEDIR/$userbk" ]; then
  898. run v-add-user $userbk $userbk [email protected]
  899. assert_success
  900. fi
  901. mkdir -p /backup
  902. local archive_name="vesta09823.2018-10-18"
  903. 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"
  904. assert_success
  905. run v-restore-user $userbk "${archive_name}.tar"
  906. assert_success
  907. rm "/backup/${archive_name}.tar"
  908. }
  909. @test "Restore[2]: From Vesta [WEB]" {
  910. local domain="vesta09823.tld"
  911. validate_web_domain $userbk "${domain}" 'Hello Vesta'
  912. }
  913. @test "Restore[2]: From Vesta [DNS]" {
  914. local domain="vesta09823.tld"
  915. run v-list-dns-domain $userbk $domain
  916. assert_success
  917. run nslookup $domain 127.0.0.1
  918. assert_success
  919. }
  920. @test "Restore[2]: From Vesta [MAIL]" {
  921. local domain="vesta09823.tld"
  922. run v-list-mail-domain $userbk $domain
  923. assert_success
  924. }
  925. @test "Restore[2]: From Vesta [MAIL-Account]" {
  926. local domain="vesta09823.tld"
  927. run v-list-mail-account $userbk $domain testaccount
  928. assert_success
  929. }
  930. @test "Restore[2]: From Vesta [DB]" {
  931. run v-list-database $userbk "${userbk}_db"
  932. assert_success
  933. }
  934. @test "Restore[2]: From Vesta [CRON]" {
  935. run v-list-cron-job $userbk 1
  936. assert_success
  937. }
  938. @test "Restore[2]: From Vesta Cleanup" {
  939. run v-delete-user $userbk
  940. assert_success
  941. refute_output
  942. }
  943. #----------------------------------------------------------#
  944. # CLEANUP #
  945. #----------------------------------------------------------#
  946. @test "Mail: Delete domain" {
  947. # skip
  948. run v-delete-mail-domain $user $domain
  949. assert_success
  950. refute_output
  951. }
  952. @test "DNS: Delete domain" {
  953. # skip
  954. run v-delete-dns-domain $user $domain
  955. assert_success
  956. refute_output
  957. }
  958. @test "WEB: Delete domain" {
  959. # skip
  960. run v-delete-web-domain $user $domain
  961. assert_success
  962. refute_output
  963. }
  964. @test "Delete user" {
  965. # skip
  966. run v-delete-user $user
  967. assert_success
  968. refute_output
  969. }
  970. @test "Ip: Delete the test IP" {
  971. # skip
  972. run v-delete-sys-ip 198.18.0.125
  973. assert_success
  974. refute_output
  975. }
  976. @test 'assert()' {
  977. touch '/var/log/test.log'
  978. assert [ -e '/var/log/test.log' ]
  979. }