Jump to: navigation, search

Difference between revisions of "Puppet/Functional testing"

(Running local tests)
(Running local tests)
Line 6: Line 6:
 
It's suggested to use a virtual machine for development.
 
It's suggested to use a virtual machine for development.
  
 +
<syntaxhighlight lang="bash">
 
  #!/bin/bash
 
  #!/bin/bash
 
  if [ -f /usr/bin/yum ]; then
 
  if [ -f /usr/bin/yum ]; then
Line 39: Line 40:
 
  export BEAKER_debug=yes
 
  export BEAKER_debug=yes
 
  bundle exec rspec spec/acceptance
 
  bundle exec rspec spec/acceptance
 +
</syntaxhighlight>
  
 
The last command runs beaker tests by installing & testing the OpenStack service.
 
The last command runs beaker tests by installing & testing the OpenStack service.

Revision as of 00:58, 15 September 2015

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.