test/automated-pytest-suite
George Postolache e32cb6361a Test suite instance from image port from robot
Added conftest.py for sanity group which imports the delete_resource
  functions from resource_mgmt
Added conftest.py for sanity_openstack group which contains a fixture
  for creating netwok and subnet used in the suites
Added suite test_instance_from_image

Story: 2007472
Task: 39164

Patch Set 2:
Fixed following pep8 and pylint errors:
  E501 line too long
  E225 missing whitespace around operator
  E222 multiple spaces after operator
  W0106: Expression is assigned to nothing (expression-not-assigned)

Patch Set 3:
  added Signed off by
  added Story
  added Task

Patch Set 4:
  Shoortened the lines to under 100 chars
  Added apache-2
  Added new marker "robotsanity" to pytest.ini
  Modified test markers to use robotsanity instead of sanity
  Commented evacuate instances test

Patch Set 5:
  Commented evacuate instances test, forgot to do it in PS4
  
Patch Set 6:
  Added space after # for comments

Change-Id: Id17e0b65bace265f4bd2166c7bd7258ba76061f4
Signed-off-by: George Postolache <george.postolache@intel.com>
2020-04-01 18:07:22 +03:00
..
consts Added new Flavor 2020-03-27 14:29:40 +02:00
keywords Merge "Updated delete_volume_snapshots and create_volume_snapshot" 2020-03-27 16:36:49 +00:00
testcases Test suite instance from image port from robot 2020-04-01 18:07:22 +03:00
testfixtures Adding admin password change test for StarlingX pytest framework 2020-03-26 15:07:54 -04:00
utils Added k8s pod to pod connectivity for starlingx pytest framework 2020-03-19 18:50:23 -04:00
README.rst Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
__init__.py Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
conftest.py Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
pytest.ini Test suite instance from image port from robot 2020-04-01 18:07:22 +03:00
requirements.txt Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
setups.py Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
stx-test_template.conf Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00

README.rst

StarlingX Integration Test Framework

The project contains integration test cases that can be executed on an installed and configured StarlingX system.

Supported test cases:

  • CLI tests over SSH connection to StarlingX system via OAM floating IP
  • Platform RestAPI test cases via external endpoints
  • Horizon test cases

Packages Required

  • python >='3.4.3,<3.7'
  • pytest>='3.1.0,<4.0'
  • pexpect
  • pyyaml
  • requests (used by RestAPI test cases only)
  • selenium (used by Horizon test cases only)
  • Firefox (used by Horizon test cases only)
  • pyvirtualdisplay (used by Horizon test cases only)
  • ffmpeg (used by Horizon test cases only)
  • Xvfb or Xephyr or Xvnc (used by pyvirtualdisplay for Horizon test cases only)

Setup Test Tool

This is a off-box test tool that needs to be set up once on a Linux server that can reach the StarlingX system under test (such as SSH to STX system, send/receive RestAPI requests, open Horizon page).

  • Install above packages
  • Clone stx-test repo
  • Add absolute path for automated-pytest-suite to PYTHONPATH environment variable

Execute Test Cases

Precondition: STX system under test should be installed and configured.

  • Customized config can be provided via --testcase-config <config_file>.
    Config template can be found at ${project_root}/stx-test_template.conf.
  • Test cases can be selected by specifying via -m <markers>
  • If stx-openstack is not deployed, platform specific marker should be specified,
    e.g., -m "platform_sanity or platform"
  • Automation logs will be created at ${HOME}/AUTOMATION_LOGS directory by default.
    Log directory can also be specified with --resultlog=${LOG_DIR} commandline option
  • Examples:
export project_root=<automated-pytest-suite dir>

# Include $project_root to PYTHONPATH if not already done
export PYTHONPATH=${PYTHONPATH}:${project_root}

cd $project_root

# Example 1: Run all platform_sanity test cases under testcases/
pytest -m platform_sanity --testcase-config=~/my_config.conf testcases/

# Example 2: Run platform_sanity or sanity (requires stx-openstack) test cases,
# on a StarlingX virtual box system that is already saved in consts/lab.py
# and save automation logs to /tmp/AUTOMATION_LOGS
pytest --resultlog=/tmp/ -m sanity --lab=vbox --natbox=localhost testcases/

# Example 3: List (not execute) the test cases with "migrate" in the name
pytest --collect-only -k "migrate" --lab=<stx_oam_fip> testcases/

Contribute

  • In order to contribute, python3.4 is required to avoid producing code that is incompatible with python3.4.