diff --git a/Vagrantfile b/Vagrantfile index dc6d07e..a1dec32 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/check_process b/check_process index 5b21f75..5151a8f 100644 --- a/check_process +++ b/check_process @@ -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) diff --git a/test.sh b/test.sh index 689e452..489e521 100755 --- a/test.sh +++ b/test.sh @@ -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