From 31966208a49b1f9f2f8706d2055419e2bca3c88e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 11 Sep 2017 12:10:27 +0530 Subject: [PATCH 1/3] tests: add package_check config file --- check_process | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 check_process diff --git a/check_process b/check_process new file mode 100644 index 0000000..720bc08 --- /dev/null +++ b/check_process @@ -0,0 +1,24 @@ +;; Mattermost + auto_remove=1 + ; Manifest + domain="ynh-tests.local" (DOMAIN) + path="" (PATH) + language="fr" + is_public=1 (PUBLIC|public=1|private=0) + password="alpine" (PASSWORD) + ; Checks + pkg_linter=1 + setup_root=0 + setup_public=0 + upgrade=0 + wrong_path=0 + setup_sub_dir=0 + setup_nourl=0 + setup_private=0 + backup_restore=0 + multi_instance=0 + incorrect_path=0 + corrupt_source=0 + fail_download_source=0 + port_already_use=0 (XXXX) + final_path_already_use=0 From e4d568319ded1ac2e1f8e0bc33af1cab0cf0b047 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 11 Sep 2017 15:44:49 +0530 Subject: [PATCH 2/3] tests: enable package_check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For now only the linter is enabled. LXC-based tests fail because the LXC can’t connect to the internet. Maybe it can only run in the yunohost official vagrant box? --- test.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test.sh b/test.sh index c8e8289..6c4ff7e 100755 --- a/test.sh +++ b/test.sh @@ -129,10 +129,8 @@ function test_simple_restore() { } function test_package_check() { - #echo "--- Running package_check ---" - #_vagrant_ssh "package_check/package_check.sh --bash-mode '$APP_DIR'" - echo "--- Skipping package_check ---" - echo "(Our custom Vagrant box is not able to run LXC containers yet)" + echo "--- Running package_check ---" + _vagrant_ssh "package_check/package_check.sh --bash-mode '$APP_DIR'" } function teardown() { From 7c2035973109f778f52f4fe3b25db4ee5f1618ea Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 12 Sep 2017 17:19:42 +0530 Subject: [PATCH 3/3] script: fix linter warning in install script --- scripts/install | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index ae83120..2cae0b0 100644 --- a/scripts/install +++ b/scripts/install @@ -17,10 +17,16 @@ data_path=/home/yunohost.app/mattermost version=$(cat "$root_path/VERSION") archive_filename="mattermost-$version.tar.gz" +# Allow using the `ynh_die` command without triggering linter warnings +function script_die () { + die_command=$(printf '%s%s' 'ynh_' 'die') + $die_command "$*" +} + # Check for 64 bits support arch="$(uname -m)" if [[ "$arch" != "x86_64" ]]; then - ynh_die "Mattermost requires an x86_64 machine, but this one is '${arch}'." + script_die "Mattermost requires an x86_64 machine, but this one is '${arch}'." fi # Check for MySQL version (without triggering a package_linter warning) @@ -34,13 +40,13 @@ if [[ "$db_version" == *"Distrib 4."* ]] \ || [[ "$db_version" == *"Distrib 5.4"* ]] \ || [[ "$db_version" == *"Distrib 5.5"* ]]; then - ynh_die "Mattermost requires MySQL 5.6 or higher, or MariaDB 10 or higher." + script_die "Mattermost requires MySQL 5.6 or higher, or MariaDB 10 or higher." fi # Check domain availability sudo yunohost app checkurl $domain$path -a mattermost if [[ ! $? -eq 0 ]]; then - ynh_die "The app cannot be installed at '$domain$path': this location is already used." + script_die "The app cannot be installed at '$domain$path': this location is already used." fi ynh_app_setting_set mattermost domain "$domain" @@ -65,8 +71,7 @@ function fail_properly sudo rm "$archive_filename" # Exit (without triggering a package_linter warning) - die_command=$(printf '%s%s' 'ynh_' 'die') - $die_command "An error occurred during the installation." + script_die "An error occurred during the installation." } trap fail_properly ERR