Add vagrant configurations for testing, readme update and fix to setting permissions for custom user

This commit is contained in:
ronivay
2018-07-26 16:32:44 +03:00
parent 3babda4c55
commit bef3113b61
7 changed files with 213 additions and 4 deletions

48
tests/CentOS/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,48 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.101"
# 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.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
# Disable the new default behavior introduced in Vagrant 1.7, to
# ensure that all Vagrant machines will use the same SSH key pair.
# See https://github.com/mitchellh/vagrant/issues/5005
config.ssh.insert_key = false
#
# Run automated test installation
#
config.vm.provision :shell, path: "../../xo-install.sh", args: "--run-test", run: 'always'
end

48
tests/Debian/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,48 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "debian/stretch64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.101"
# 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.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
# Disable the new default behavior introduced in Vagrant 1.7, to
# ensure that all Vagrant machines will use the same SSH key pair.
# See https://github.com/mitchellh/vagrant/issues/5005
config.ssh.insert_key = false
#
# Run automated test installation
#
config.vm.provision :shell, path: "../../xo-install.sh", args: "--run-test", run: 'always'
end

48
tests/Ubuntu/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,48 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/xenial64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.101"
# 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.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
# Disable the new default behavior introduced in Vagrant 1.7, to
# ensure that all Vagrant machines will use the same SSH key pair.
# See https://github.com/mitchellh/vagrant/issues/5005
config.ssh.insert_key = false
#
# Run automated test installation
#
config.vm.provision :shell, path: "../../xo-install.sh", args: "--run-test", run: 'always'
end

55
tests/run-tests.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
function RunTestsSingle {
export VAGRANT_CWD="$(dirname $0)/$1"
local LOGFILE="$(dirname $0)/$1/installation-test.log"
vagrant up &> $LOGFILE
sleep 5
echo "" >> $LOGFILE
curl -s -L 192.168.33.101 >> $LOGFILE 2>&1 || false
if [[ $? == "1" ]]; then
echo "$1 HTTP Check: failed"
else
echo "$1 HTTP Check: success"
fi
sleep 5
vagrant destroy -f &> $LOGFILE
unset VAGRANT_CWD
echo $1
}
function RunTestsAll {
for x in CentOS Debian Ubuntu; do
export VAGRANT_CWD="$(dirname $0)/$x"
local LOGFILE="$(dirname $0)/$x/installation-test.log"
vagrant up &> $LOGFILE
sleep 5
echo "" >> $LOGFILE
echo "Curl output:" >> $LOGFILE
curl -s -L -m 5 192.168.33.101 >> $LOGFILE 2>&1 || false
if [[ $? == "1" ]]; then
echo "$x HTTP Check: failed"
else
echo "$x HTTP Check: success"
fi
sleep 5
vagrant destroy -f &> $LOGFILE
unset VAGRANT_CWD
done
}
if [[ $# == "1" ]]; then
RunTestsSingle "$1"
exit 0
else
RunTestsAll
exit 0
fi