<commit_before>System(scenario) tests for Sahara project
=========================================

How to run
----------

Create the YAML and/or the YAML mako template files for scenario tests
``etc/scenario/sahara-ci/simple-testcase.yaml``.
You can take a look at sample YAML files `How to write scenario files`_.

If you want to run scenario tests for one plugin, you should use the
YAML files with a scenario for the specific plugin:

.. sourcecode:: console

    $ tox -e scenario etc/scenario/sahara-ci/simple-testcase.yaml
..

or, if the file is a YAML Mako template:

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/scenario/vanilla-2.6.0.yaml.mako
..

where templatevars.ini contains the values of the variables referenced
by ``vanilla-2.6.0.yaml.mako``.

For example, you want to run tests for the Vanilla plugin with the Hadoop
version 2.6.0 In this case you should create ``templatevars.ini`` with
the appropriate values (see the section `Variables and sahara-ci templates`_)
and use the following tox env:

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/vanilla-1.2.1.yaml.mako
..

If you want to run scenario tests for a few plugins or their versions, you
should use the several YAML and/or YAML Mako template files:

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/vanilla-1.2.1.yaml.mako etc/scenario/sahara-ci/vanilla-2.6.0.yaml.mako ...
..

Here are a few more examples.

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/credentials.yaml.mako etc/scenario/sahara-ci/vanilla-2.6.0.yaml.mako

..

will run tests for Vanilla plugin with the Hadoop version 2.6.0 and credential
located in ``etc/scenario/sahara-ci/credential.yaml.mako``, replacing the variables
included into ``vanilla-2.6.0.yaml.mako`` with the values defined into
``templatevars.ini``.
For more information about writing scenario YAML files, see the section
section `How to write scenario files`_.

``tox -e scenario etc/scenario/sahara-ci`` will run tests from the test directory.


Template variables
------------------
The variables used in the Mako template files are replaced with the values from a
INI-style file, whose name is passed to the test runner through the ``-V`` parameter.

Format of recording variables:
    ``OS_USERNAME: admin``

Variables and sahara-ci templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following variables are currently used by sahara-ci templates:

+-----------------------------+--------+--------------------------------------------------------------+
|   Variable                  |  Type  |          Value                                               |
+=============================+========+==============================================================+
| OS_USERNAME                 | string | user name for login                                          |
+-----------------------------+--------+--------------------------------------------------------------+
| OS_PASSWORD                 | string | password name for login                                      |<commit_msg>Doc, scenario tests: variables config file<commit_after>System(scenario) tests for Sahara project
=========================================

How to run
----------

Create the YAML and/or the YAML mako template files for scenario tests
``etc/scenario/sahara-ci/simple-testcase.yaml``.
You can take a look at sample YAML files `How to write scenario files`_.

If you want to run scenario tests for one plugin, you should use the
YAML files with a scenario for the specific plugin:

.. sourcecode:: console

    $ tox -e scenario etc/scenario/sahara-ci/simple-testcase.yaml
..

or, if the file is a YAML Mako template:

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/scenario/vanilla-2.6.0.yaml.mako
..

where templatevars.ini contains the values of the variables referenced
by ``vanilla-2.6.0.yaml.mako``.

For example, you want to run tests for the Vanilla plugin with the Hadoop
version 2.6.0 In this case you should create ``templatevars.ini`` with
the appropriate values (see the section `Variables and sahara-ci templates`_)
and use the following tox env:

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/vanilla-1.2.1.yaml.mako
..

If you want to run scenario tests for a few plugins or their versions, you
should use the several YAML and/or YAML Mako template files:

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/vanilla-1.2.1.yaml.mako etc/scenario/sahara-ci/vanilla-2.6.0.yaml.mako ...
..

Here are a few more examples.

.. sourcecode:: console

    $ tox -e scenario -- -V templatevars.ini etc/scenario/sahara-ci/credentials.yaml.mako etc/scenario/sahara-ci/vanilla-2.6.0.yaml.mako

..

will run tests for Vanilla plugin with the Hadoop version 2.6.0 and credential
located in ``etc/scenario/sahara-ci/credential.yaml.mako``, replacing the variables
included into ``vanilla-2.6.0.yaml.mako`` with the values defined into
``templatevars.ini``.
For more information about writing scenario YAML files, see the section
section `How to write scenario files`_.

``tox -e scenario etc/scenario/sahara-ci`` will run tests from the test directory.


Template variables
------------------
The variables used in the Mako template files are replaced with the values from a
config file, whose name is passed to the test runner through the ``-V`` parameter.

The format of the config file is an INI-style file, as accepted by the Python
ConfigParser module. The key/values must be specified in the DEFAULT section.

Example of template variables file:
.. sourcecode:: ini

    [DEFAULT]
    OS_USERNAME: demo
    OS_TENANT_NAME: demo
    OS_PASSWORD: <PASSWORD>
    ...
    network_type: neutron
    ...

..

Variables and sahara-ci templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following variables are currently used by sahara-ci templates:

+-----------------------------+--------+--------------------------------------------------------------+
|   Variable                  |  Type  |          Value                                               |
+=============================+========+==============================================================+
| OS_USERNAME                 | string | user name for login                                          |
+-----------------------------+--------+--------------------------------------------------------------+
| OS_PASSWORD                 | string | password name for login                                      |
{'fraction_non_alphanumeric': 0.19790575916230366, 'fraction_numerical': 0.008077786088257292, 'mean_word_length': 2.333000997008973, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '646980', 'n_tokens_mistral': 1836, 'n_tokens_neox': 1755, 'n_words': 661}