diff --git a/doc/source/ci.rst b/doc/source/ci.rst new file mode 100644 index 0000000..fd194bc --- /dev/null +++ b/doc/source/ci.rst @@ -0,0 +1,103 @@ +###################### +Continuous Integration +###################### + + +This is a list of the CI jobs that are running against most of Puppet +OpenStack modules: The code that configure Jenkins jobs is hosted by +`project-config +`__. + +.. list-table:: **CI Jobs in puppet-openstack** + :widths: 12 25 8 55 + :header-rows: 1 + + * - Job name + - Description + - Voting + - What to do in case of failure + * - gate-puppet--puppet-lint + - It makes sure the code follows recommended `Puppet style guidelines + `__ + - Yes + - Read the job logs to see where the code does not follow the Puppet lint + style. + * - gate-puppet--puppet-syntax-{3,4} + - Syntax checks for Puppet manifests, templates, and Hiera YAML. The jobs + runs on latest Puppet 3.x and 4.x releases. + - Yes + - Read the job logs to see where the code does not follow the Puppet + syntax style. + * - gate-puppet--puppet-unit-{3.4,3.6,3.7,3.8,4.0} + - RSpec tests for Puppet manifests. The jobs runs on Puppet 3.4, 3.6, + 3.7, 3.8 and 4.0. + - Yes + - Read the job logs to see where the tests are failing. `More + documentation about RSpec `__ + * - gate-puppet--puppet-unit-latest + - RSpec tests for Puppet manifests. The jobs runs on the latest version + of Puppet. It aims to be experimental to track any work to do in the + module to be compatible with the latest release of Puppet. + - No + - Read the job logs to see where the tests are failing. Even though the + job is not voting, please raise a bug in Launchpad to make sure someone + have a look and maybe update the module to work with latest version of + Puppet. + * - gate-puppet--puppet-beaker-rspec-dsvm-{centos7,trusty} + - Beaker jobs to do functional testing. It will prepare the Puppet + environment on 2 different systems (CentOS 7 and Ubuntu Trusty), run + Puppet to configure the module resources and run some tests with + serverspec. + - Yes + - Read the job logs. Sometimes, the job fails because of packaging issues + or mirrors downtime. Please report a bug for this so we can find + workarounds. Otherwise, make sure your patch is supposed to work with + current tests or you'll have to adapt the tests to change the expected + behavior. `More documentation about Beaker + `__ + * - gate-puppet-openstack-integration-{3,4}-scenarioX-tempest-dsvm-{centos7 + ,trusty} + - Functional testing jobs that will deploy OpenStack run tempest smoke to + validate OpenStack is actually working. Now deploy Puppet 3 but our + team is testing Puppet 4 too. More details `here `__ + - Yes + - Read the job logs. Sometimes, the job fails because of + packaging issues or mirrors downtime. Please report a bug for this so we + can find workarounds. It can also be a problem in Tempest, a new test + that is failing or a new parameter which is missing. + * - check-tripleo-ironic-overcloud-f21puppet-nonha + - Deploy a `TripleO `__ + overcloud by running Puppet OpenStack modules. + - No + - If it's not a TripleO CI downtime, you can dig into + os-collect-config.txt.gz logs to see why catalog is failing. Sometimes + it's very interesting to test the modules against a real use-case + (TripleO is an OpenStack installer). Also make sure to consult the + `status of TripleO CI `__. + * - puppet-openstack.fuel-library.pkgs.ubuntu.{neutron\_vlan\_ha,smoke\_neutron} + - Deploy OpenStack cloud on top of libvirt VMs using `Fuel + `__ and Puppet OpenStack modules. + More details `here + `__ + - No + - You can read the job logs and take a look into diagnostic snapshot + attached to the build, however it takes some understanding of Fuel + mechanics to make a good use of this logs. Fuel engineers will + investigate the failure according to `Fuel CI duty for Puppet OpenStack + `__ + and may contact you to discuss the reason behind failure. Feel free to + aks any questions on #fuel-dev at freenode. + * - puppet-openstack.fuel.noop + - Read the job logs. Fuel engineers will investigate the failure + according to `Fuel CI duty for Puppet OpenStack + `__ + and may contact you to discuss the reason behind failure. Feel free to + aks any questions on #fuel-dev at freenode. + - No + - Run `Fuel-library `__ noop + tests against Puppet OpenStack modules. More details `here + `_ + + diff --git a/doc/source/index.rst b/doc/source/index.rst index 914d158..901168a 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -15,6 +15,7 @@ OpenStack cloud deployments. backporting community mailing-list + testing .. note:: This documentation is work in progress, we are moving the content diff --git a/doc/source/testing-your-code.rst b/doc/source/testing-your-code.rst new file mode 100644 index 0000000..bb1390b --- /dev/null +++ b/doc/source/testing-your-code.rst @@ -0,0 +1,99 @@ +################# +Testing your code +################# + +#. `Unit Tests`_ +#. `Functional Tests`_ + + +Unit Tests +========== + +Unit tests are written in ruby, so you need to be familiar with Rspec, below +you can find usefull comands to test your code. + +Running Rspec +------------- + +The following command can be invoked in any module diretories to run their +rspec tests (lint, syntax, spec, acceptance, etc). It assumes that both +bundler as well as rubygems (and ruby) are already installed on the system. + + +.. code-block:: bash + + mkdir vendor + export GEM_HOME=vendor + bundle install + bundle exec rake lint # Run puppet-lint + bundle exec rake syntax # Syntax check Puppet manifests and templates + bundle exec rake spec # Run spec tests in a clean fixtures directory + bundle exec rake acceptance # Run acceptance tests + + +This relies on the file fixtures.yaml to install all of the external module +required for testing. The url in this file use the git:// protocol, so this +may need to be updated if you are behind a proxy. + +.. note:: + + Be advised that your local run can be sucessfull and you can get a -1 from + Jenkis, because you only run the tests for your Operating System Family. + +The best reference for getting started with rspec-puppet can be found here_. + +.. _here: http://rspec-puppet.com/ + +Functional Tests +================ + +We use beaker to run functional tests, the best reference for getting started +with beaker can be found `here `__. + +Running beaker +-------------- + +.. code:: bash + + #!/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. diff --git a/doc/source/testing.rst b/doc/source/testing.rst new file mode 100644 index 0000000..6fff115 --- /dev/null +++ b/doc/source/testing.rst @@ -0,0 +1,13 @@ +####### +Testing +####### + +As contributor to any of the puppet-openstack repositories and you are not +familiar with the tests we use, you should visit testing you code and CI +section. + +.. toctree:: + :maxdepth: 2 + + testing-your-code.rst + ci.rst