diff --git a/Vagrantfile b/Vagrantfile index d3e86f4..907983c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,8 +10,8 @@ Vagrant.configure("2") do |config| # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. - config.vm.define :mattermost_ynh - config.vm.box = "debian/contrib-jessie64" + config.vm.define :ynh_tests + config.vm.box = "yunohost/jessie-stable" # Disable auto updates checks. Run `vagrant outdated` to perform manual updates. config.vm.box_check_update = false @@ -36,36 +36,26 @@ 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 - TESTS_DIR="/home/vagrant/tests" - APP_DIR="$TESTS_DIR/mattermost_ynh" - VM_ROOT_PASSWORD="alpine" + DOMAIN=ynh-tests.local YUNOHOST_ADMIN_PASSWORD="alpine" # Stop on first error set -e - # Upgrade the system packages + # Upgrade Yunohost and the system packages (disabled) #DEBIAN_FRONTEND=noninteractive sudo apt-get update #DEBIAN_FRONTEND=noninteractive sudo apt-get upgrade --yes -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' - # Install git - hash git 2>/dev/null || sudo apt-get install git --yes - - # Install Yunohost - if ! hash yunohost 2>/dev/null; then - git clone https://github.com/YunoHost/install_script /tmp/install_script - yes ${VM_ROOT_PASSWORD} | sudo passwd - cd /tmp/install_script - echo "Running Yunohost install script…" - sudo ./install_yunohost -a - sudo yunohost tools postinstall --domain mattermost-ynh.local --password ${YUNOHOST_ADMIN_PASSWORD} + # Finish Yunohost installation + if ! [[ -f /etc/yunohost/installed ]]; then + 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 + # 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 diff --git a/test.sh b/test.sh index 59b2e65..9d0f890 100755 --- a/test.sh +++ b/test.sh @@ -10,7 +10,8 @@ set -e # Configuration constants APP_NAME="mattermost" TESTS_DIR="/home/vagrant/tests" -APP_DIR="$TESTS_DIR/mattermost_ynh" +APP_DIR="$TESTS_DIR/app" +DOMAIN="ynh-tests.local" VM_ROOT_PASSWORD="alpine" YUNOHOST_ADMIN_PASSWORD="alpine" @@ -81,16 +82,19 @@ function setup() { return fi - if (vagrant snapshot list | grep 'yunohost-2.4-pristine' > /dev/null); then + if (vagrant snapshot list | grep 'yunohost-jessie-pristine' > /dev/null); then echo "--- Restoring Vagrant snapshot ---" - vagrant snapshot restore yunohost-2.4-pristine + vagrant snapshot restore yunohost-jessie-pristine else echo "--- Provisioning Vagrant box ---" vagrant up --provision echo "--- Saving Vagrant snapshot ---" - vagrant snapshot save yunohost-2.4-pristine + vagrant snapshot save yunohost-jessie-pristine fi + # Copy the files inside the VM, rather than using the mounted + # files directly. + # This avoids tests screwing up our files if something goes wrong. echo "--- Copying app content into the box ---" if ! [ -d "$APP_DIR" ]; then _vagrant_ssh "mkdir -p '$TESTS_DIR'" @@ -100,7 +104,7 @@ function setup() { function test_simple_install() { echo "--- Running simple installation test ---" - _vagrant_ssh "sudo yunohost app install '$APP_DIR' --args 'domain=mattermost-ynh.local&public_site=Yes&analytics=0' $VERBOSE_OPT" + _vagrant_ssh "sudo yunohost app install '$APP_DIR' --args 'domain=${DOMAIN}&public_site=Yes&analytics=0' $VERBOSE_OPT" } function test_simple_upgrade() {