Skip to content

Instantly share code, notes, and snippets.

@lukego
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukego/bdefc792b8255d141e4c to your computer and use it in GitHub Desktop.
Save lukego/bdefc792b8255d141e4c to your computer and use it in GitHub Desktop.
#!/bin/bash
trap "touch /vagrant/done" EXIT
sudo su vagrant /vagrant/test-run.sh 2>&1 | tee /vagrant/console.log
sudo apt-get install -q -y git
# Install and run devstack
echo -n "$(date '+%F %T') devstack.. " >> /vagrant/progress.txt
cd $HOME
git clone https://github.com/openstack-dev/devstack.git
cd devstack
cp /vagrant/local.conf .
./stack.sh
echo "ok" >> /vagrant/progress.txt
# Install and run tempest
echo -n "$(date '+%F %T') tempest.. " >> /vagrant/progress.txt
cd $HOME
git clone git://git.openstack.org/openstack/tempest.git
cd tempest
sudo python ./setup.py install
cd /opt/stack/tempest
testr init
testr run tempest.api.network.test_networks | tee /vagrant/tempest.log
if grep PASSED /vagrant/tempest.log; then
echo "passed" >> /vagrant/progress.txt
else
echo "failed" >> /vagrant/progress.txt
fi
# That's it
echo "$(date '+%F %T') Finished" >> /vagrant/progress.txt
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "trusty"
config.vm.provision "shell", path: "ci.sh"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
end
end
@kevinbenton
Copy link

grepping for PASSED seems delicate. Can't you just check the return code of testr?

if [ $? -eq 0 ]; then
    echo "passed" >> /vagrant/progress.txt
else
    echo "failed" >> /vagrant/progress.txt
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment