Jump to: navigation, search

Difference between revisions of "Puppet/Functional testing"

(retire page)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
'''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/'''
 +
 +
<strike>
 
The best reference for getting started with beaker can be found [https://github.com/puppetlabs/beaker/wiki here].
 
The best reference for getting started with beaker can be found [https://github.com/puppetlabs/beaker/wiki here].
  
Line 6: Line 9:
 
It's suggested to use a virtual machine for development.
 
It's suggested to use a virtual machine for development.
  
#!/bin/bash
+
<br />
if [ -f /usr/bin/yum ]; then
+
 
    sudo yum -y install libxml2-devel libxslt-devel ruby-devel
+
 
    sudo yum -y groupinstall "Development Tools"
+
<syntaxhighlight lang="bash">
    OS_TYPE='centos7'
+
#!/bin/bash
elif [ -f /usr/bin/apt-get ]; then
+
if [ -f /usr/bin/yum ]; then
    sudo apt-get update
+
    sudo yum -y install libxml2-devel libxslt-devel ruby-devel
    sudo apt-get install -y libxml2-dev libxslt-dev zlib1g-dev git ruby ruby-dev build-essential
+
    sudo yum -y groupinstall "Development Tools"
    OS_TYPE='trusty'
+
    OS_TYPE='centos7'
fi
+
elif [ -f /usr/bin/apt-get ]; then
echo "" | sudo tee -a /etc/ssh/sshd_config
+
    sudo apt-get update
echo "Match address 127.0.0.1" | sudo tee -a /etc/ssh/sshd_config
+
    sudo apt-get install -y libxml2-dev libxslt-dev zlib1g-dev git ruby ruby-dev build-essential
echo "    PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
+
    OS_TYPE='trusty'
echo "" | sudo tee -a /etc/ssh/sshd_config
+
fi
echo "Match address ::1" | sudo tee -a /etc/ssh/sshd_config
+
echo "" | sudo tee -a /etc/ssh/sshd_config
echo "    PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
+
echo "Match address 127.0.0.1" | sudo tee -a /etc/ssh/sshd_config
mkdir -p .ssh
+
echo "    PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -C "beaker key" -P ""
+
echo "" | sudo tee -a /etc/ssh/sshd_config
sudo mkdir -p /root/.ssh
+
echo "Match address ::1" | sudo tee -a /etc/ssh/sshd_config
sudo rm /root/.ssh/authorized_keys
+
echo "    PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys
+
mkdir -p .ssh
if [ -f /usr/bin/yum ]; then
+
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -C "beaker key" -P ""
    sudo systemctl restart sshd
+
sudo mkdir -p /root/.ssh
elif [ -f /usr/bin/apt-get ]; then
+
sudo rm /root/.ssh/authorized_keys
    sudo service ssh restart
+
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys
fi
+
if [ -f /usr/bin/yum ]; then
sudo gem install bundler --no-rdoc --no-ri --verbose
+
    sudo systemctl restart sshd
mkdir .bundled_gems
+
elif [ -f /usr/bin/apt-get ]; then
export GEM_HOME=`pwd`/.bundled_gems
+
    sudo service ssh restart
bundle install
+
fi
export BEAKER_set=nodepool-$OS_TYPE
+
sudo gem install bundler --no-rdoc --no-ri --verbose
export BEAKER_debug=yes
+
mkdir .bundled_gems
bundle exec rspec spec/acceptance
+
export GEM_HOME=`pwd`/.bundled_gems
 +
bundle install
 +
export BEAKER_set=nodepool-$OS_TYPE
 +
export BEAKER_debug=yes
 +
bundle exec rspec spec/acceptance
 +
</syntaxhighlight>
 +
 
 +
<br />
 +
 
  
The last command run beaker tests by installing & testing the OpenStack service.
+
The last command runs beaker tests by installing & testing the OpenStack service.
 +
</strike>

Latest revision as of 23:29, 18 May 2016

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.