devtest
=======

(There are detailed instructions available below, the overview and
configuration sections provide background information).

Overview:
 * Define a VM that is your seed node
 * Define N VMs to pretend to be your cluster
 * Create a seed VM
 * Create an undercloud
 * Create an overcloud
 * Deploy a sample workload in the overcloud
 * Add environment variables to be included to ~/.devtestrc, e.g. http_proxy
 * Go to town testing deployments on them.
 * For troubleshooting see :doc:`troubleshooting`
 * For generic deployment information see :doc:`deploying`

This document is extracted from devtest.sh, our automated bring-up story for
CI/experimentation.

Permissions
-----------

These scripts are designed to be run under your normal user account. The
scripts make use of sudo when elevated privileges are needed. You will
either need to run this attended, entering your password when sudo needs
it, or enable passwordless sudo for your user. Another option is to extend
the timeout of sudo sessions so that passwordless sudo will be allowed
enough time on the controlling terminal to complete the devtest run. If
there are any circumstances where running as a normal user, and not root,
fails, this is considered a critical bug.

Sudo
~~~~

In order to set the sudo session timeout higher, add this to /etc/sudoers::

    Defaults    timestamp_timeout=240 # 4 hours

This will result in 4 hour timeouts for sudo session credentials. To
reset the timeout run::

    sudo -k; sudo -v


In order to set a user to full passwordless operation add this (typically
near the end of /etc/sudoers)::

    username    ALL = NOPASSWD: ALL


Stability Warning
-----------------

Note that every effort is made to keep the published set of these instructions
updated for use with only the master branches of the TripleO projects. There is
**NO** guaranteed stability in master. There is also no guaranteed stable
upgrade path from release to release or from one stable branch to a later
stable branch. The stable branches are a point in time and make no
guarantee about deploying older or newer branches of OpenStack projects
correctly.

If you wish to use the stable branches, you should instead checkout and clone
the stable branch of tripleo-incubator you want, and then build the
instructions yourself via::

     git clone https://git.openstack.org/openstack/tripleo-incubator
     cd tripleo-incubator
     git checkout <stable-branch>
     tox -evenv python setup.py build_sphinx
     # View doc/build/html/devtest.html in your browser and proceed from there

Next Steps:
-----------

When run as a standalone script, devtest.sh runs the following commands
to configure the devtest environment, bootstrap a seed, deploy under and
overclouds. Many of these commands are also part of our documentation.
Readers may choose to either run the commands given here, or instead follow
the documentation for each command and walk through it step by step to see
what is going on. This choice can be made on a case by case basis - for
instance, if bootstrapping is not interesting, run that as devtest does,
then step into the undercloud setup for granular details of bringing up a
baremetal cloud.


#. See :doc:`devtest_variables` for documentation. Assuming you're still at
   the root of your checkout::

       source scripts/devtest_variables.sh

#. See :doc:`devtest_setup` for documentation.
   $CONTINUE should be set to '--trash-my-machine' to have it execute
   unattended.
   ::

        devtest_setup.sh $CONTINUE

#. See :doc:`devtest_testenv` for documentation. Note that you can make
   your test environment just once and reuse it thereafter.
   TE_DATAFILE should specify where you want your test environment JSON
   file created. (A default value is set in devtest_variables.sh).
   ::

        devtest_testenv.sh $TE_DATAFILE $NODES_ARG

#. See :doc:`devtest_ramdisk` for documentation::

        devtest_ramdisk.sh

#. See :doc:`devtest_seed` for documentation::

        devtest_seed.sh

#. See :doc:`devtest_undercloud` for documentation::

        export no_proxy=${no_proxy:-},192.0.2.1
        source $TRIPLEO_ROOT/tripleo-incubator/seedrc
        devtest_undercloud.sh $TE_DATAFILE
        export no_proxy=$no_proxy,$(os-apply-config --type raw -m $TE_DATAFILE --key undercloud.endpointhost)
        source $TRIPLEO_ROOT/tripleo-incubator/undercloudrc

#. See :doc:`devtest_overcloud` for documentation::

        devtest_overcloud.sh
        export no_proxy=$no_proxy,$(os-apply-config --type raw -m $TE_DATAFILE --key overcloud.endpointhost)
        source $TRIPLEO_ROOT/tripleo-incubator/overcloudrc

#. See :doc:`devtest_end` for documentation::

        devtest_end.sh

