1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00

Merge pull request #68 from YunoHost-Apps/package_checker

Enable package_check tests in the VM
This commit is contained in:
Pierre de La Morinerie 2017-10-24 11:56:00 +05:30 committed by GitHub
commit 00b1605e47
3 changed files with 42 additions and 16 deletions

49
Vagrantfile vendored
View file

@ -10,7 +10,7 @@ Vagrant.configure("2") do |config|
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
config.vm.define :ynh_tests
config.vm.define :ynhtests
config.vm.box = "yunohost/jessie-stable"
# Disable auto updates checks. Run `vagrant outdated` to perform manual updates.
@ -26,41 +26,68 @@ Vagrant.configure("2") do |config|
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.10"
# Use the NAT hosts DNS resolver. Fixes slow network in the guest.
# See https://serverfault.com/questions/495914/vagrant-slow-internet-connection-in-guest
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
end
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./", "/vagrant"
config.vm.synced_folder "./", "/vagrant",
owner: "root",
group: "sudo",
mount_options: ["dmode=775,fmode=774"]
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", privileged: false, keep_color: true, inline: <<-SHELL
DOMAIN=ynh-tests.local
DOMAIN=ynhtests.local
YUNOHOST_ADMIN_PASSWORD="alpine"
# Stop on first error
set -e
if ! [[ -f /etc/yunohost/installed ]]; then
# Upgrade Yunohost and the system packages (disabled)
# Upgrade Yunohost and the system packages
sudo apt-get update
sudo apt-get upgrade --yes
sudo apt-get dist-upgrade --yes
# Run dist-upgrade twice, as the first Yunohost upgrade may fail
sudo apt-get dist-upgrade --yes || sudo apt-get dist-upgrade --yes
# Finish Yunohost installation
sudo yunohost tools postinstall --domain ${DOMAIN} --password ${YUNOHOST_ADMIN_PASSWORD} --ignore-dyndns
fi
# Install lxc
# if ! hash lxc-start 2>/dev/null; then
# DEBIAN_FRONTEND=noninteractive sudo apt-get update
# DEBIAN_FRONTEND=noninteractive sudo apt-get install --yes --fix-missing lxc
# fi
# Install package_check
if ! [ -f "$HOME/package_check/package_check.sh" ]; then
git clone https://github.com/YunoHost/package_check
# Checkout our custom patches (until they get merged upstream)
cd package_check
git remote add kemenaran https://github.com/kemenaran/package_check.git
git fetch kemenaran
git checkout --track kemenaran/fixes
# Fix LXC containers not being able to reach outside internet.
# The default configuration is to detect the default gateway used
# by the Vagrant machine to configure LXC containers.
# Unfortunately this results in the LXC containers not being able
# to connect to the Internet.
echo "dns=8.8.8.8" > $HOME/package_check/config
fi
# Build the initial LXC container
if ! hash lxc-start 2>/dev/null || [ "$(sudo lxc-ls | wc -l)" == "0" ]; then
# Build the default LXC container
$HOME/package_check/sub_scripts/lxc_build.sh
# Ensure the LXC container is correctly configured
$HOME/package_check/sub_scripts/lxc_check.sh
fi
SHELL
end

View file

@ -1,6 +1,6 @@
;; Mattermost
; Manifest
domain="ynh-tests.local" (DOMAIN)
domain="ynhtests.local" (DOMAIN)
path="" (PATH)
language="fr"
is_public=1 (PUBLIC|public=1|private=0)

View file

@ -10,7 +10,7 @@ set -e
# Configuration constants
APP_NAME="mattermost"
APP_DIR="/vagrant"
DOMAIN="ynh-tests.local"
DOMAIN="ynhtests.local"
VM_ROOT_PASSWORD="alpine"
YUNOHOST_ADMIN_PASSWORD="alpine"
@ -142,7 +142,7 @@ function test_simple_restore() {
function test_package_check() {
echo "--- Running package_check ---"
_vagrant_ssh "package_check/package_check.sh --bash-mode '$APP_DIR'"
_vagrant_ssh "package_check/package_check.sh --build-lxc --bash-mode '$APP_DIR'"
}
function teardown() {
@ -151,8 +151,7 @@ function teardown() {
_parse_args $*
setup
# Package_check is disabled until LXC containers work properly inside the Vagrant VM
#test_package_check
test_package_check
test_simple_install
test_simple_upgrade
test_simple_backup