Jump to: navigation, search

Puppet/Functional testing

These docs are outdated, but kept here for historical reasons and search access. To view the latest docs, please refer to http://docs.openstack.org/developer/puppet-openstack-guide/

The best reference for getting started with beaker can be found here.

Running local tests

The following script can invoked from any if the modules' directories to run their beaker tests. It assumes that both bundler as well as rubygems (and ruby) are already installed on the system. It will prepare the system and run beaker tests on the system. It's suggested to use a virtual machine for development.



#!/bin/bash
if [ -f /usr/bin/yum ]; then
    sudo yum -y install libxml2-devel libxslt-devel ruby-devel
    sudo yum -y groupinstall "Development Tools"
    OS_TYPE='centos7'
elif [ -f /usr/bin/apt-get ]; then
    sudo apt-get update
    sudo apt-get install -y libxml2-dev libxslt-dev zlib1g-dev git ruby ruby-dev build-essential
    OS_TYPE='trusty'
fi
echo "" | sudo tee -a /etc/ssh/sshd_config
echo "Match address 127.0.0.1" | sudo tee -a /etc/ssh/sshd_config
echo "    PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
echo "" | sudo tee -a /etc/ssh/sshd_config
echo "Match address ::1" | sudo tee -a /etc/ssh/sshd_config
echo "    PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
mkdir -p .ssh
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -C "beaker key" -P ""
sudo mkdir -p /root/.ssh
sudo rm /root/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys
if [ -f /usr/bin/yum ]; then
    sudo systemctl restart sshd
elif [ -f /usr/bin/apt-get ]; then
    sudo service ssh restart
fi
sudo gem install bundler --no-rdoc --no-ri --verbose
mkdir .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
bundle install
export BEAKER_set=nodepool-$OS_TYPE
export BEAKER_debug=yes
bundle exec rspec spec/acceptance



The last command runs beaker tests by installing & testing the OpenStack service.