From 2e3bd9f87b530df72e33ab22fe7dd323cc5050f6 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Oct 2017 18:53:34 +0530 Subject: [PATCH 1/3] Vagrantfile: don't limit network speed --- Vagrantfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index dc6d07e..52b68b7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -26,6 +26,14 @@ 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 From 4e028257b66eb0d0ee9b78b0373605a24e93e6c9 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Oct 2017 14:29:18 +0530 Subject: [PATCH 2/3] test: rename ynh-tests.local to ynh_tests.local `ynh-dev` prefers when the box name has no dashes. --- Vagrantfile | 4 ++-- check_process | 2 +- test.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 52b68b7..ce03391 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. @@ -44,7 +44,7 @@ Vagrant.configure("2") do |config| # 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 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..0e5ea7a 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" From d0930de6a6bfb0f7ae04ef9404405043d9e9b6b1 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Oct 2017 14:06:40 +0000 Subject: [PATCH 3/3] test: fix LXC usage in test VM --- Vagrantfile | 37 ++++++++++++++++++++++++++++--------- test.sh | 5 ++--- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index ce03391..a1dec32 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -38,7 +38,10 @@ Vagrant.configure("2") do |config| # 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 @@ -51,24 +54,40 @@ Vagrant.configure("2") do |config| 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/test.sh b/test.sh index 0e5ea7a..489e521 100755 --- a/test.sh +++ b/test.sh @@ -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