# This file is used by the jenkins job
# read: 'How it works' section at the bottom


### config template ###
# test_env:       # top-level namespace used by khaleesi
#   env_name:     # test config
#     Distro-Version:   # test configuration for the distro-version
#     | setup:          # how the testbed VM needs to be setup
#     | ' repos:        # add the following repos
#     | '   - filename: repo-name.repo
#     | '     contents: |
#     | '       [section]
#     | '       contents
#     | '       of
#     | '       Repo
#
#     | ' install:      # install the following rpm and
#     | '   - rpm-abc   # ensure latest is installed
#     | '   - rpm-foo
#     | '   - rpm-bar
#
#     | ' remove:       # delete the following rpms
#     | '   - rpm-foo
#     | '   - rpm-bar
#     | '   - rpm-baz
#     | ' pip:         # use virtualenv --system-site-packages to
#     | '   overrides: # override system packages
#     | '   - pip-pkg-foo
#     | '   - pip-pkg-foo
#
#     | run: >      # how tests should be run
#     |  run_command; another_command;
#     |  ./run_tests.sh -N -P    # all but last statement should terminated by ;
#
#     | archive:  # what files to archive
#     |   - nosetest.xml
#
#  NOTE: there must be a env_name: called virt: which will be used to run tests
#  in virtualenv when running tests in env_name fails

product:
    name: rhos
    repo_type: poodle
    version: 7
    full_version: 7.0
    config:
        enable_epel: y
    rpmrepo:
        RedHat: http://rhos-release.virt.bos.redhat.com/repos/rhos-release/


tripleo_ui_rpm_deps: [
  'gcc',
  'git',
  'gcc-c++',
  'make',
  'nodejs',
  'curl'
]
#  'npm'

tripleo_ui_virt_config:
  setup:
    install: "{{tripleo_ui_rpm_deps}}"
  run: >
      set -o pipefail;
      mkdir node_install;
      export npm_config_prefix=`pwd`/node_install;
      curl -L https://www.npmjs.com/install.sh | sh;
      $npm_config_prefix/bin/npm install;
      $npm_config_prefix/bin/npm test;
      $npm_config_prefix/bin/npm run lint;
  archive:
      - ../logs/venv-testrun.log
      - tests_results.xml
      - tox.ini
      - requirements.txt
      - all-rpms.txt

### actual test_config: starts here: used by khaleesi ###
### NOTE: test_config.virt must be defined ###
test_config:
  virt:
    Fedora-20:  "{{tripleo_ui_virt_config}}"
    RedHat-7: "{{tripleo_ui_virt_config}}"
    Centos-7: "{{tripleo_ui_virt_config}}"

# How this works!
# ==============
# This file is used by khaleesi[1] playbook unit_test.yml[2].
#  - The jenkins job checks out khaleesi, settings and this repo and
#    runs unit_test.yml playbook.
#  - The playbook reads this config file and
#      - adds repos in test_dependencies.rpm.repos
#      - installs all packages in  test_dependencies.rpm.install
#      - removes all packages in test_dependencies.rpm.remove
#  - it then runs the test by executing the command specfied in
#    test_env.run NOTE all commands should terminate with a ';'
#  - if tests fail, the same is run in venv with pip packages.
#
# PIP overrides
# -------------
# When there is no corresponding rpm for a pip package, you can override that
# particular package using the pip.override section. When you do so, make sure
# the packaging team is notified about the new requirement.
#
# [1] https://github.com/redhat-openstack/khaleesi
# [2] https://github.com/redhat-openstack/khaleesi/blob/master/playbooks/unit_test.yml
