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

test: fix LXC usage in test VM

This commit is contained in:
Pierre de La Morinerie 2017-10-23 14:06:40 +00:00
parent 4e028257b6
commit d0930de6a6
2 changed files with 30 additions and 12 deletions

37
Vagrantfile vendored
View file

@ -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 host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third # the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options. # 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 # Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
@ -51,24 +54,40 @@ Vagrant.configure("2") do |config|
set -e set -e
if ! [[ -f /etc/yunohost/installed ]]; then 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 update
sudo apt-get upgrade --yes 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 # Finish Yunohost installation
sudo yunohost tools postinstall --domain ${DOMAIN} --password ${YUNOHOST_ADMIN_PASSWORD} --ignore-dyndns sudo yunohost tools postinstall --domain ${DOMAIN} --password ${YUNOHOST_ADMIN_PASSWORD} --ignore-dyndns
fi 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 # Install package_check
if ! [ -f "$HOME/package_check/package_check.sh" ]; then if ! [ -f "$HOME/package_check/package_check.sh" ]; then
git clone https://github.com/YunoHost/package_check 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 fi
SHELL SHELL
end end

View file

@ -142,7 +142,7 @@ function test_simple_restore() {
function test_package_check() { function test_package_check() {
echo "--- Running 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() { function teardown() {
@ -151,8 +151,7 @@ function teardown() {
_parse_args $* _parse_args $*
setup 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_install
test_simple_upgrade test_simple_upgrade
test_simple_backup test_simple_backup