Merge pull request #1018 from edx/will/vagrant-can-run-tests
Updated Vagrant file with requirements for tests
This commit is contained in:
3
Vagrantfile
vendored
3
Vagrantfile
vendored
@@ -22,12 +22,13 @@ Vagrant.configure("2") do |config|
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
# Use VBoxManage to customize the VM. For example to change memory:
|
||||
vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
vb.customize ["modifyvm", :id, "--memory", "2048"]
|
||||
|
||||
# This setting makes it so that network access from inside the vagrant guest
|
||||
# is able to resolve DNS using the hosts VPN connection.
|
||||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||
end
|
||||
|
||||
config.vm.provision :shell, :path => "scripts/install-acceptance-req.sh"
|
||||
config.vm.provision :shell, :path => "scripts/vagrant-provisioning.sh"
|
||||
end
|
||||
|
||||
84
scripts/install-acceptance-req.sh
Executable file
84
scripts/install-acceptance-req.sh
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install all the requirements for running the
|
||||
# acceptance test suite and the JavaScript
|
||||
# unit test suite.
|
||||
#
|
||||
# Requires 32-bit Ubuntu
|
||||
|
||||
# Exit if any commands return a non-zero status
|
||||
set -e
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get install unzip
|
||||
|
||||
# Install xvfb
|
||||
if [ -z `command -v xvfb` ]; then
|
||||
echo "Installing Xvfb..."
|
||||
sudo apt-get install -y xvfb
|
||||
|
||||
# Install the xvfb upstart script
|
||||
sudo cat > /etc/init/xvfb.conf <<END
|
||||
description "Xvfb X Server"
|
||||
start on (net-device-up
|
||||
and local-filesystems
|
||||
and runlevel [2345])
|
||||
stop on runlevel [016]
|
||||
exec /usr/bin/Xvfb :99 -screen 0 1024x768x24
|
||||
END
|
||||
|
||||
cat >> .bashrc <<END
|
||||
|
||||
# Set the display to the virtual frame buffer (Xvfb)
|
||||
export DISPLAY=:99
|
||||
END
|
||||
else
|
||||
echo "Already installed; skipping."
|
||||
fi
|
||||
|
||||
# Ensure that xvfb is running
|
||||
sudo start xvfb 2> /dev/null || sudo restart xvfb 2> /dev/null || echo "Cannot start xvfb"
|
||||
|
||||
# Move to a temp directory so we can download things
|
||||
cd /var/tmp
|
||||
|
||||
# Install Chrome
|
||||
echo "Downloading Google Chrome..."
|
||||
if [ -z `command -v google-chrome` ]; then
|
||||
wget --quiet https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
|
||||
sudo dpkg -i google-chrome*.deb 2> /dev/null || true
|
||||
sudo apt-get -f -y install
|
||||
else
|
||||
echo "Already installed; skipping."
|
||||
fi
|
||||
|
||||
# Install ChromeDriver
|
||||
echo "Installing ChromeDriver..."
|
||||
if [ -z `command -v chromedriver` ]; then
|
||||
wget --quiet https://chromedriver.googlecode.com/files/chromedriver_linux32_2.3.zip
|
||||
unzip chromedriver_linux32_2.3.zip
|
||||
sudo mv chromedriver /usr/local/bin/chromedriver
|
||||
sudo chmod go+rx /usr/local/bin/chromedriver
|
||||
else
|
||||
echo "Already installed; skipping."
|
||||
fi
|
||||
|
||||
# Install Firefox
|
||||
echo "Installing Firefox..."
|
||||
sudo apt-get -y install firefox
|
||||
|
||||
# Install dbus (required for FF)
|
||||
sudo apt-get -y install dbus-x11
|
||||
|
||||
# Install PhantomJS
|
||||
echo "Installing PhantomJS..."
|
||||
if [ -z `command -v phantomjs` ]; then
|
||||
wget --quiet "https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-i686.tar.bz2"
|
||||
tar -xjf phantomjs-1.9.1-linux-i686.tar.bz2
|
||||
sudo mv phantomjs-1.9.1-linux-i686/bin/phantomjs /usr/local/bin/phantomjs
|
||||
else
|
||||
echo "Already installed; skipping."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user