-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
198 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
def test_composer(host): | ||
assert host.check_output('composer -V').startswith('Composer version 2') | ||
assert host.file("/var/www/.composer/composer.json").exists | ||
|
||
@pytest.mark.parametrize("bin", [ | ||
("parallel-lint"), | ||
("pdepend"), | ||
("phpcs"), | ||
("phploc"), | ||
("phpmd"), | ||
("phpmetrics"), | ||
("phpqa"), | ||
("phpstan"), | ||
("robo"), | ||
]) | ||
def test_composer_bin(host, bin): | ||
''' Test bin exist ''' | ||
assert host.file("var/www/.composer/vendor/bin/" + bin).exists | ||
assert host.file("/usr/local/bin/" + bin).is_symlink | ||
assert host.file("/usr/local/bin/" + bin).mode == 0o777 | ||
|
||
def test_phpcs_standard(host): | ||
'''' Test phpcs standards ''' | ||
assert host.check_output('phpcs -i').__contains__('Drupal') | ||
assert host.check_output('phpcs -i').__contains__('DrupalPractice') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import pytest | ||
|
||
def test_drush(host): | ||
''' Test drush exist ''' | ||
assert host.file("/opt/drupal/vendor/bin/drush").exists | ||
assert host.file("/opt/drupal/vendor/bin/drush").mode == 0o755 | ||
assert host.file("drush --version").startwith("Drush Commandline Tool") | ||
assert host.file("drush --root=/opt/drupal/web status --field=drupal-version").startwith("9.3") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
|
||
@pytest.mark.parametrize("name", [ | ||
("bash"), | ||
("bc"), | ||
("curl"), | ||
("git"), | ||
("jq"), | ||
("gettext"), | ||
("openssh"), | ||
("xsltproc"), | ||
("mariadb-client"), | ||
("postgresql-client"), | ||
("node"), | ||
("yarn"), | ||
]) | ||
def test_packages_installed(host, name): | ||
''' Test a minimum of required packages ''' | ||
pkg = host.package(name) | ||
assert pkg.is_installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
|
||
@pytest.mark.parametrize("folder", [ | ||
("/opt/drupal/web/core"), | ||
("/opt/drupal/web/modules"), | ||
("/opt/drupal/web/themes"), | ||
("/opt/drupal/web/sites"), | ||
("/var/www"), | ||
]) | ||
def test_permissions(host, folder): | ||
''' Test folder permissions ''' | ||
assert host.file(folder).user == "www-data" | ||
assert host.file(folder).group == "www-data" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
import pytest | ||
|
||
def test_php_version(host): | ||
''' Check PHP version so it's highlighted when changed ''' | ||
assert host.check_output('php -v').startswith('PHP 8.0') | ||
''' Check PHP version so it's highlighted when changed ''' | ||
assert host.check_output('php -v').startswith('PHP 8.0') | ||
|
||
# @pytest.mark.parametrize("name", [ | ||
# ("bcmath"), | ||
# ("gd"), | ||
# ("pdo_pgsql"), | ||
# ("intl"), | ||
# ("zip"), | ||
# ("xsl"), | ||
# ("OPcache"), | ||
# ("apcu"), | ||
# ("igbinary"), | ||
# ("redis"), | ||
# ]) | ||
# def test_php_modules(host, name): | ||
# ''' Test the minimum list of needed extensions ''' | ||
# assert host.check_output('php -m | grep ' + name) | ||
|
||
# def test_deploy_scripts_exists(host): | ||
# assert host.file("/scripts/drupal-deploy.sh").exists | ||
# assert host.file("/scripts/drupal-ensure-nfs.sh").exists | ||
# assert host.file("/scripts/drupal-maintenance.sh").exists | ||
@pytest.mark.parametrize("name", [ | ||
("sockets"), | ||
("opcache"), | ||
("ftp"), | ||
("intl"), | ||
("xsl"), | ||
("mysqli"), | ||
("Zend OPcache"), | ||
("xdebug"), | ||
]) | ||
def test_php_modules(host, name): | ||
''' Test the minimum list of needed extensions ''' | ||
assert host.check_output('php -m | grep ' + name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pytest | ||
import configparser | ||
|
||
config = configparser.ConfigParser() | ||
|
||
def test_php_ini(host): | ||
assert host.file("/usr/local/etc/php/php.ini").exists | ||
|
||
def test_php_ini_values(host): | ||
''' Check important config that should be highlighted when changed ''' | ||
config.read('/usr/local/etc/php/php.ini') | ||
assert config['PHP']['max_execution_time'] == '90' | ||
assert config['PHP']['max_input_nesting_level'] == '512' | ||
assert config['PHP']['memory_limit'] == '4G' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
def test_composer(host): | ||
assert host.check_output('composer -V').startswith('Composer version 2') | ||
assert host.file("/var/www/.composer/composer.json").exists | ||
|
||
@pytest.mark.parametrize("bin", [ | ||
("parallel-lint"), | ||
("pdepend"), | ||
("phpcs"), | ||
("phploc"), | ||
("phpmd"), | ||
("phpmetrics"), | ||
("phpqa"), | ||
("phpstan"), | ||
("robo"), | ||
]) | ||
def test_composer_bin(host, bin): | ||
''' Test bin exist ''' | ||
assert host.file("var/www/.composer/vendor/bin/" + bin).exists | ||
assert host.file("/usr/local/bin/" + bin).is_symlink | ||
assert host.file("/usr/local/bin/" + bin).mode == 0o777 | ||
|
||
def test_phpcs_standard(host): | ||
'''' Test phpcs standards ''' | ||
assert host.check_output('phpcs -i').__contains__('Drupal') | ||
assert host.check_output('phpcs -i').__contains__('DrupalPractice') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import pytest | ||
|
||
def test_drush(host): | ||
''' Test drush exist ''' | ||
assert host.file("/opt/drupal/vendor/bin/drush").exists | ||
assert host.file("/opt/drupal/vendor/bin/drush").mode == 0o755 | ||
assert host.file("drush --version").startwith("Drush Commandline Tool") | ||
assert host.file("drush --root=/opt/drupal/web status --field=drupal-version").startwith("$DRUPAL_VERSION") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
|
||
@pytest.mark.parametrize("name", [ | ||
("bash"), | ||
("bc"), | ||
("curl"), | ||
("git"), | ||
("jq"), | ||
("gettext"), | ||
("openssh"), | ||
("xsltproc"), | ||
("mariadb-client"), | ||
("postgresql-client"), | ||
("node"), | ||
("yarn"), | ||
]) | ||
def test_packages_installed(host, name): | ||
''' Test a minimum of required packages ''' | ||
pkg = host.package(name) | ||
assert pkg.is_installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
|
||
@pytest.mark.parametrize("folder", [ | ||
("/opt/drupal/web/core"), | ||
("/opt/drupal/web/modules"), | ||
("/opt/drupal/web/themes"), | ||
("/opt/drupal/web/sites"), | ||
("/var/www"), | ||
]) | ||
def test_permissions(host, folder): | ||
''' Test folder permissions ''' | ||
assert host.file(folder).user == "www-data" | ||
assert host.file(folder).group == "www-data" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
import pytest | ||
|
||
def test_php_version(host): | ||
''' Check PHP version so it's highlighted when changed ''' | ||
assert host.check_output('php -v').startswith('PHP 8.0') | ||
''' Check PHP version so it's highlighted when changed ''' | ||
assert host.check_output('php -v').startswith('PHP $PHP_VERSION') | ||
|
||
# @pytest.mark.parametrize("name", [ | ||
# ("bcmath"), | ||
# ("gd"), | ||
# ("pdo_pgsql"), | ||
# ("intl"), | ||
# ("zip"), | ||
# ("xsl"), | ||
# ("OPcache"), | ||
# ("apcu"), | ||
# ("igbinary"), | ||
# ("redis"), | ||
# ]) | ||
# def test_php_modules(host, name): | ||
# ''' Test the minimum list of needed extensions ''' | ||
# assert host.check_output('php -m | grep ' + name) | ||
|
||
# def test_deploy_scripts_exists(host): | ||
# assert host.file("/scripts/drupal-deploy.sh").exists | ||
# assert host.file("/scripts/drupal-ensure-nfs.sh").exists | ||
# assert host.file("/scripts/drupal-maintenance.sh").exists | ||
@pytest.mark.parametrize("name", [ | ||
("sockets"), | ||
("opcache"), | ||
("ftp"), | ||
("intl"), | ||
("xsl"), | ||
("mysqli"), | ||
("Zend OPcache"), | ||
("xdebug"), | ||
]) | ||
def test_php_modules(host, name): | ||
''' Test the minimum list of needed extensions ''' | ||
assert host.check_output('php -m | grep ' + name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pytest | ||
import configparser | ||
|
||
config = configparser.ConfigParser() | ||
|
||
def test_php_ini(host): | ||
assert host.file("/usr/local/etc/php/php.ini").exists | ||
|
||
def test_php_ini_values(host): | ||
''' Check important config that should be highlighted when changed ''' | ||
config.read('/usr/local/etc/php/php.ini') | ||
assert config['PHP']['max_execution_time'] == '90' | ||
assert config['PHP']['max_input_nesting_level'] == '512' | ||
assert config['PHP']['memory_limit'] == '4G' |