cloudv-ostf-adapter/README.rst
Denis Makogon 64b99e5008 Introducing python client for cloudvalidation ReST service
Change-Id: I01748eaa30eaf1d79b8178a36cebdfddd91bc949
2015-03-19 15:54:54 +02:00

6.5 KiB

Cloud Validation adapter for OSTF

Overview

Existing [OSTF](http://docs.mirantis.com/fuel-dev/develop/ostf_contributors_guide.html) code provides a number of tests which cover a number of cases needed for cloud validation. The downside of existing OSTF is that it is tightly coupled with FUEL's nailgun. Given project aims to create standalone adapter for OSTF which is independent of FUEL thus making it possible to run OSTF tests on any random cloud (in theory).

High-level design

CLI tool that works with health check plugins Supported plugins:

- fuel health check

Usage

Please note that if you're using Fuel OSTF plugin, you have to install it manually.

$ cloudvalidation cloud-health-check {argument} [argument_parameters]

Arguments:

list_plugins - Lists plugins
list_plugin_suites - Lists plugin test suites
list_plugin_tests - Lists plugin tests from all available suites
run_suites - Runs all tests from all suites
run_suite - Runs certain test suite
run_test - Runs certain test

Examples

$ cloudvalidation cloud-health-check list_plugins
Property Value
name suites fuel_health fuel_health.tests.sanity.test_sanity_identity.SanityIdentityTest fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest fuel_health.tests.sanity.test_sanity_heat.SanityHeatTest fuel_health.tests.smoke.test_create_flavor.FlavorsAdminTest
$ cloudvalidation cloud-health-check list_plugin_suites --validation-plugin fuel_health
Property Value
suites fuel_health.tests.sanity.test_sanity_identity.SanityIdentityTest fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest fuel_health.tests.sanity.test_sanity_heat.SanityHeatTest fuel_health.tests.smoke.test_create_flavor.FlavorsAdminTest
$ cloudvalidation cloud-health-check list_plugin_tests --validation-plugin fuel_health
Property Value
tests fuel_health.tests.sanity.test_sanity_identity.SanityIdentityTest:test_list_services fuel_health.tests.sanity.test_sanity_identity.SanityIdentityTest:test_list_users fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest:test_list_flavors fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest:test_list_images fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest:test_list_instances fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest:test_list_rate_limits fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest:test_list_snapshots fuel_health.tests.sanity.test_sanity_compute.SanityComputeTest:test_list_volumes fuel_health.tests.sanity.test_sanity_heat.SanityHeatTest:test_list_stacks fuel_health.tests.smoke.test_create_flavor.FlavorsAdminTest:test_create_flavor
$ cloudvalidation --config-dir=/etc/cloudv_ostf_adapter cloud-health-check run_suites --validation-plugin-name fuel_health

Request user list ... ok Request flavor list ... ok Request image list ... ok Request instance list ... ok Request absolute limits list ... ok Request snapshot list ... ok Request volume list ... ok Request stack list ... ok Create instance flavor ... ok

----------------------------------------------------------------------Ran 9 tests in 5.310s

OK

$ cloudvalidation --config-dir=/etc/cloudv_ostf_adapter cloud-health-check run_suite --validation-plugin-name fuel_health --suite fuel_health.tests.sanity.test_sanity_identity.SanityIdentityTest

Running test suite: fuel_health.tests.sanity.test_sanity_identity.SanityIdentityTest ... Request user list ... ok

----------------------------------------------------------------------Ran 1 test in 0.938s

OK

REST API

Run server

$ cloudvalidation-server --config-file=path_to_config
* Running on http://127.0.0.1:8777/ (Press CTRL+C to quit)

Example of config

[rest] server_host=127.0.0.1 server_port=8777 log_file=/var/log/ostf.log debug=False

List of supported operations

  • get list of supported plugins GET /v1/plugins?load_tests=True/False In load_tests=True case tests for plugin will be shown.
  • get suites in plugin GET /v1/plugins/<plugin_name>/suites
  • get tests for all suites in plugin GET /v1/plugins/<plugin_name>/suites/tests
  • get tests per suite in plugin GET /v1/plugins/<plugin_name>/suites/<suite>/tests
  • run suites for plugin POST /v1/plugins/<plugin_name>/suites
  • run suite for plugin POST /v1/plugins/<plugin_name>/suites/<suite>
  • run test for plugin /v1/plugins/<plugin_name>/suites/tests/<test>

REST API Client usage

from cloudv_ostf_adapter.cloudv_client import client

cloudvclient = client.Client(CONF.host, CONF.port, CONF.api_version)

plugins = cloudvclient.plugins.list()
plugin_one = plugins[0]['name']

suites = cloudvalidation.suites.list_suites(plugin_one)