Compare commits

..

55 Commits

Author SHA1 Message Date
OpenStack Proposal Bot
723d39cd65 Updated from global requirements
Change-Id: I32bd693211fe91f86f1f2e1f5921ad56fbeaf1e5
2017-04-12 04:22:27 +00:00
Jenkins
07b19ede3f Merge "Remove log translations" 2017-03-29 12:57:12 +00:00
daohanli
94c317250e Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Icfe6ab464fd9fbbbfb9c9a05dba2220aa9e0bace
2017-03-23 10:43:15 +08:00
Luong Anh Tuan
7250886d14 Indicating the location tests directory in oslo_debug_helper
According to [1], we can passing a "-t" argument to
oslo_debug_helper to indicate the directory where tests
are located. This will solves ImportError exception.

[1] https://docs.openstack.org/developer/oslotest/features.html

Change-Id: Id72596a8c3d9e2e344ef492f2d60b89bc0422aec
Closes-Bug: #1666560
2017-03-22 10:14:22 +00:00
Jenkins
03ac32b1be Merge "Using assert methods instead of assertTrue" 2017-03-08 09:35:39 +00:00
Jenkins
89390ac0a9 Merge "Updated from global requirements" 2017-03-03 08:28:09 +00:00
zhuzeyu
69c10379af Using assert methods instead of assertTrue
It will print a nicer error message if it fails.

Change-Id: I6fb9054e3285db76057db373fe87964e510de516
2017-03-03 06:33:21 +00:00
Jenkins
0ea4020d98 Merge "Remove support for py34" 2017-03-03 05:44:14 +00:00
Jenkins
cbcc990383 Merge "update help description about actionplan create" 2017-03-03 03:19:08 +00:00
OpenStack Proposal Bot
15f519f827 Updated from global requirements
Change-Id: I6055fa04daf29ae76845af307e844d94ba030117
2017-03-03 03:09:00 +00:00
ricolin
1ccf0588f9 [Fix gate]Update test requirement
Since pbr already landed and the old version of hacking seems not
work very well with pbr>=2, we should update it to match global
requirement.
Partial-Bug: #1668848

Change-Id: I21616cbbd11d2ccab60155ea78ed261ee12db5d4
2017-03-02 20:14:13 +08:00
Chris Spencer
cd267c9fa4 Remove RST files located in doc/source/api.
Change-Id: Ib9600297b6b65a44a72090cfb0c7d8f80dcfd34a
Closes-Bug: 1640811
2017-02-14 10:06:50 -07:00
gengchc2
ce477baa1f Remove support for py34
The gating on python 3.4 is restricted to <= Mitaka. This is due
to the change from Ubuntu Trusty to Xenial, where only python3.5
is available. There is no need to continue to keep these settings.

Change-Id: I66b76645b7799c6550583c675bc968310d5e0d1c
2017-02-08 16:33:34 +08:00
licanwei
cd918fe086 update help description about actionplan create
help=_("ActionPlan type.")
=>
help=_("Audit type. It must be ONESHOT or CONTINUOUS. "
       "Default is ONESHOT."))

Change-Id: Ic79b5d1d0cb5ed459aaa290269219ff0e00065d5
2017-02-07 09:56:47 +08:00
Jenkins
1f7df3d53d Merge "Using jsonutils instead of json" 2017-02-03 08:47:00 +00:00
zhuzeyu
dfe9d31ee4 Using jsonutils instead of json
TrivialFix

Change-Id: I1d17994f4cf854f6ba62c75ed18ebee3c7f5fa47
2017-02-03 15:48:12 +08:00
Jenkins
2ea26be247 Merge "Add functional env to tox" 2017-02-02 08:40:25 +00:00
OpenStack Proposal Bot
15b5fb791e Updated from global requirements
Change-Id: I487004e11fc37040601562bc2cf807d5d853335a
2017-01-25 09:37:23 +00:00
zhuzeyu
eafb6b21f7 Remove useless utf-8 coding
TrivialFix

Change-Id: I37d77df21349f3c113582a0a6e51a84be297cc73
2017-01-25 15:20:48 +08:00
Alexander Chadin
08cf7d99d3 Add functional env to tox
This patch set adds functional environment to tox
to be able to create post_hook file for functional gate.

Change-Id: I8e918fe47f6008b9570e39c2d0e9159d0d223362
2017-01-23 18:58:43 +03:00
Jenkins
cec8ee4f15 Merge "Add functional tests to watcherclient" 2017-01-19 14:54:54 +00:00
Jenkins
4713a69a18 Merge "Support parents field along with planner changes" 2017-01-19 14:19:12 +00:00
Jenkins
22bc9a97c9 Merge "Updated from global requirements" 2017-01-17 16:12:11 +00:00
licanwei
11e3568d66 update '--detail' help in goal list
help=_("Show detailed information about metric collectors."))
==>
help=_("Show detailed information about each goal."))

Change-Id: If6bf750a6a7941524dd144430abcc48b9f44a9d3
2017-01-17 16:49:19 +08:00
OpenStack Proposal Bot
96ef016b81 Updated from global requirements
Change-Id: I6239c242d4ab23ec885556daddc45d0f97b8234c
2017-01-16 17:28:36 +00:00
Alexander Chadin
c0f6ea54f6 Add functional tests to watcherclient
This Patch Set implements functional tests for
watcherclient to cover all use cases of watcher objects.

Implements : blueprint tempest-cli-test
Change-Id: I920d5b1ae25c62a72d3474538f866a5415c2e119
2017-01-16 17:08:27 +00:00
Alexander Chadin
b8666d511e Support parents field along with planner changes
This patch set allows python-watcherclient to show
parents field instead of next_uuid field.

Partially Implements: blueprint planner-storage-action-plan
Change-Id: I00cefd2ba6dad5daa6470c851c2fdfb7c22d7a63
Depends-On: Ide2c8fc521488e486eac8f9f89d3f808ccf4b4d7
2017-01-16 20:05:10 +03:00
Jenkins
4a093e168d Merge "Enable coverage report in console output" 2017-01-16 11:09:11 +00:00
Jenkins
1fa93eeb8f Merge "Add auto_trigger support" 2017-01-16 10:18:55 +00:00
Jenkins
d36f2de07e Merge "Add param 'goal' and 'strategy' in list()" 2017-01-13 16:38:00 +00:00
Jenkins
d17bc25fef Merge "Use keystoneauth instead of keystoneclient" 2017-01-13 15:06:21 +00:00
Lucky samadhiya
075b32efe2 changes to make consistent with other openstack component
Change-Id: I4a530ff7912f129823783c742f906d769965872e
2017-01-13 10:10:01 +00:00
Jeremy Liu
a2cbb8d4b2 Use keystoneauth instead of keystoneclient
keystoneauth was extracted from keystoneclient, this CR replaces usage
of keystoneclient in favor of keystoneauth.

Implements: blueprint use-keystoneauth-instead-of-keystoneclient
Change-Id: Iada0f8b45ae30a89908a4ae9e5f55a33e3744e17
2017-01-13 16:14:33 +08:00
Jeremy Liu
ecfa35ecc2 Remove unused files
`MANIFEST.in` was used to handle git files but now pbr can do it instead.
`openstack-common.conf` was used to copy files from oslo-incubator, but
oslo-incubator is no longer maintained. So delete the two files from repo.

Change-Id: I976434e8283c588191d7bfb9321f46cea724406a
2017-01-13 14:39:04 +08:00
Jeremy Liu
546d03c3aa Enable coverage report in console output
Change-Id: I861dbe49eb888e9c51a0c649dffde4479f19ee67
2017-01-13 10:51:12 +08:00
licanwei
3a04f9fb9a Add param 'goal' and 'strategy' in list()
watcher  audit list --goal dummy
list() got an unexpected keyword argument 'goal'

watcher  audit list --strategy dummy
list() got an unexpected keyword argument 'strategy'

Change-Id: Iba4b89da1669f07002718c885107ee3813ca676a
Closes-Bug: #1654962
2017-01-12 11:54:56 +08:00
DeepaJon
17a144e2f8 Removes unnecessary utf-8 encoding
This patches removes unnecessary utf-8 encoding in the
watcherclient/*
doc/source/conf.py

Change-Id: Ic74c9c57f52f7bf021dfa25d4de069b57e5cb474
2017-01-11 14:23:40 +05:30
licanwei
658fd038f3 update audit create '--interval' description
update audit create '--interval' description

Change-Id: I03779a8fe446c051397f02cfb2d73bda804706fe
2017-01-10 18:02:55 +01:00
Jenkins
d2aede7151 Merge "Fix a typo in audittemplate help" 2017-01-10 16:29:41 +00:00
Jenkins
de54d5b8ba Merge "Add unit for continuous audit's interval." 2017-01-10 16:27:10 +00:00
Jenkins
ae003b7e76 Merge "use 'auto' instead of None" 2017-01-10 16:27:01 +00:00
ericxiett
d08c0e3ef1 Add unit for continuous audit's interval.
End user does not get the unit of 'interval' when use command
``watcher audit create -h``. This patch adds unit for the option
'interval'. Aslo use single quotes.

Change-Id: I9e3df031822f2f2704a3c661c6a5953d7e0caae5
Closes-Bug: #1653322
2017-01-03 08:07:10 +08:00
licanwei
c68120edcd Fix a typo in audittemplate help
'Descrition'->'Description'

Change-Id: Ie1f06f14a06e27c52b41b1d8c7da1f160212288d
2016-12-26 10:29:02 +08:00
licanwei
bf7085fabd use 'auto' instead of None
In cli cmds:watcher audit create,
the Strategy is None if no --strategy
It's better to use default instead of None
watcher audit create -g thermal_optimization
+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| UUID        | 2bc3001d-683a-48ee-b2f2-766cb8d6329e |
| Created At  | 2016-12-22T08:41:21.173601+00:00     |
| Updated At  | None                                 |
| Deleted At  | None                                 |
| State       | PENDING                              |
| Audit Type  | ONESHOT                              |
| Parameters  | {}                                   |
| Interval    | None                                 |
| Goal        | thermal_optimization                 |
| Strategy    | None                                 |
| Audit Scope | []                                   |
+-------------+--------------------------------------+

Change-Id: I5798df81303c425ed0e26e401589e6680b945bf6
2016-12-22 17:52:29 +08:00
Jenkins
ef93a57b46 Merge "too many digits after the decimal point" 2016-12-19 11:03:17 +00:00
Alexander Chadin
6e291f0f13 Add auto_trigger support
This patch set adds support of auto-triggering for action plans.
You can use it by adding new attribute '--auto-trigger' to
watcher audit create command.

Change-Id: I2e4ee53f9f639cb3248c0e4dcc7b9716ff1fc352
Partially-Implements: blueprint automatic-triggering-audit
Depends-On: I36b7dff8eab5f6ebb18f6f4e752cf4b263456293
2016-12-16 17:01:46 +00:00
Jenkins
73dcf25b63 Merge "Replace six.iteritems() with .items()" 2016-12-16 16:34:15 +00:00
zhangguoqing
0ecafcd6a0 Fix TOKENID format which should without dashed
[1] is wrong amendment which had change the TOKENID's format.
Since [2] had been merged, this patch fix the format without dashed.

[1] https://review.openstack.org/#/c/399359/1/watcherclient/tests/keystone_client_fixtures.py
[2] https://review.openstack.org/#/c/398788

Change-Id: I80b953cbf31e2b09160f0b55ffe48eea845c2dd4
2016-12-15 14:40:21 +00:00
licanwei
529f406075 too many digits after the decimal point
'global_efficacy' field print too many digits
 after the decimal point.
 for example 14.2857142857 %
 two digits are enough
 for example 14.29%

Closes-Bug: #1650159

Change-Id: I4af3ef5b250d7e0b921269cc91ec46978d090c10
2016-12-15 09:08:34 +00:00
Antoine Cabot
b66834506a Remove readme reference because of sphinx error
Change-Id: Ide4b84131fd516ae4784dab9673354c5bab0968a
Closes-Bug: #1650173
2016-12-15 09:42:46 +01:00
gengchc2
5b8e3d4d6c Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: Ic6af69d5b4b36f3dd02aab0f9c446aa54970f388
2016-12-09 11:31:24 +08:00
OpenStack Proposal Bot
fce4e7e10c Updated from global requirements
Change-Id: Ifc867f3be4b569c6ec9a5fce1149d949bce09685
2016-12-02 17:18:38 +00:00
Flavio Percoco
8004b4ec0b Show team and repo badges on README
This patch adds the team's and repository's badges to the README file.
The motivation behind this is to communicate the project status and
features at first glance.

For more information about this effort, please read this email thread:

http://lists.openstack.org/pipermail/openstack-dev/2016-October/105562.html

To see an example of how this would look like check:

https://gist.github.com/f8cdc5cce16393ddd9885f99ad05a610

Change-Id: I58f89eb319919a824fea21961b4338e2d1132f6e
2016-11-25 17:23:24 +01:00
OpenStack Proposal Bot
0584350663 Updated from global requirements
Change-Id: I98b97ab69a726f1634f6c96274d02cde60b064c2
2016-11-18 21:33:33 +00:00
qinchunhua
ccef7be62c Use uuidutils instead of uuid.uuid4()
Openstack common has a wrapper for generating uuids.
We should only use that function when generating
uuids for consistency.

Change-Id: Ic36426c6ab4228826b66a926e74e3331e9a9abdc
Closes-Bug: #1082248
2016-11-18 11:27:48 +08:00
128 changed files with 931 additions and 524 deletions

View File

@@ -1,6 +0,0 @@
include AUTHORS
include ChangeLog
exclude .gitignore
exclude .gitreview
global-exclude *.pyc

View File

@@ -1,3 +1,12 @@
========================
Team and repository tags
========================
.. image:: http://governance.openstack.org/badges/python-watcherclient.svg
:target: http://governance.openstack.org/reference/tags/index.html
.. Change things from this point on
====================
python-watcherclient
====================

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.client` Module
======================================
.. automodule:: watcherclient.client
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.apiclient.auth` Module
=====================================================
.. automodule:: watcherclient.common.apiclient.auth
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.apiclient.base` Module
=====================================================
.. automodule:: watcherclient.common.apiclient.base
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.apiclient.client` Module
=======================================================
.. automodule:: watcherclient.common.apiclient.client
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.apiclient.exceptions` Module
===========================================================
.. automodule:: watcherclient.common.apiclient.exceptions
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.apiclient.utils` Module
======================================================
.. automodule:: watcherclient.common.apiclient.utils
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.base` Module
===========================================
.. automodule:: watcherclient.common.base
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.cliutils` Module
===============================================
.. automodule:: watcherclient.common.cliutils
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.http` Module
===========================================
.. automodule:: watcherclient.common.http
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.i18n` Module
===========================================
.. automodule:: watcherclient.common.i18n
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.common.utils` Module
============================================
.. automodule:: watcherclient.common.utils
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.exceptions` Module
==========================================
.. automodule:: watcherclient.exceptions
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.shell` Module
=====================================
.. automodule:: watcherclient.shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.keystone_client_fixtures` Module
==============================================================
.. automodule:: watcherclient.tests.keystone_client_fixtures
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.test_client` Module
=================================================
.. automodule:: watcherclient.tests.test_client
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.test_http` Module
===============================================
.. automodule:: watcherclient.tests.test_http
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.test_import` Module
=================================================
.. automodule:: watcherclient.tests.test_import
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.test_shell` Module
================================================
.. automodule:: watcherclient.tests.test_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.test_utils` Module
================================================
.. automodule:: watcherclient.tests.test_utils
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.utils` Module
===========================================
.. automodule:: watcherclient.tests.utils
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_action` Module
====================================================
.. automodule:: watcherclient.tests.v1.test_action
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_action_plan` Module
=========================================================
.. automodule:: watcherclient.tests.v1.test_action_plan
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_action_plan_shell` Module
===============================================================
.. automodule:: watcherclient.tests.v1.test_action_plan_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_action_shell` Module
==========================================================
.. automodule:: watcherclient.tests.v1.test_action_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_audit` Module
===================================================
.. automodule:: watcherclient.tests.v1.test_audit
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_audit_shell` Module
=========================================================
.. automodule:: watcherclient.tests.v1.test_audit_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_audit_template` Module
============================================================
.. automodule:: watcherclient.tests.v1.test_audit_template
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_audit_template_shell` Module
==================================================================
.. automodule:: watcherclient.tests.v1.test_audit_template_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_goal` Module
==================================================
.. automodule:: watcherclient.tests.v1.test_goal
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_goal_shell` Module
========================================================
.. automodule:: watcherclient.tests.v1.test_goal_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_metric_collector` Module
==============================================================
.. automodule:: watcherclient.tests.v1.test_metric_collector
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.tests.v1.test_metric_collector_shell` Module
====================================================================
.. automodule:: watcherclient.tests.v1.test_metric_collector_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.action` Module
=========================================
.. automodule:: watcherclient.v1.action
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.action_plan` Module
==============================================
.. automodule:: watcherclient.v1.action_plan
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.action_plan_shell` Module
====================================================
.. automodule:: watcherclient.v1.action_plan_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.action_shell` Module
===============================================
.. automodule:: watcherclient.v1.action_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.audit` Module
========================================
.. automodule:: watcherclient.v1.audit
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.audit_shell` Module
==============================================
.. automodule:: watcherclient.v1.audit_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.audit_template` Module
=================================================
.. automodule:: watcherclient.v1.audit_template
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.audit_template_shell` Module
=======================================================
.. automodule:: watcherclient.v1.audit_template_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.client` Module
=========================================
.. automodule:: watcherclient.v1.client
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.goal` Module
=======================================
.. automodule:: watcherclient.v1.goal
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.goal_shell` Module
=============================================
.. automodule:: watcherclient.v1.goal_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.metric_collector` Module
===================================================
.. automodule:: watcherclient.v1.metric_collector
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.metric_collector_shell` Module
=========================================================
.. automodule:: watcherclient.v1.metric_collector_shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.resource_fields` Module
==================================================
.. automodule:: watcherclient.v1.resource_fields
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.v1.shell` Module
========================================
.. automodule:: watcherclient.v1.shell
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,7 +0,0 @@
The :mod:`watcherclient.version` Module
=======================================
.. automodule:: watcherclient.version
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@@ -14,7 +14,6 @@ Contents:
.. toctree::
:maxdepth: 1
readme
installation
api_v1
cli

View File

@@ -1 +0,0 @@
.. include:: ../../README.rst

View File

@@ -1,10 +0,0 @@
[DEFAULT]
# The list of modules to copy from oslo-incubator.git
module=apiclient
module=cliutils
module=_i18n
# The base module to hold the copy of openstack.common
base=watcherclient

View File

@@ -2,13 +2,13 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
Babel>=2.3.4 # BSD
cliff>=2.2.0 # Apache-2.0
Babel!=2.4.0,>=2.3.4 # BSD
cliff>=2.3.0 # Apache-2.0
osc-lib>=1.2.0 # Apache-2.0
oslo.i18n>=2.1.0 # Apache-2.0
oslo.utils>=3.18.0 # Apache-2.0
pbr>=1.8 # Apache-2.0
oslo.utils>=3.20.0 # Apache-2.0
pbr!=2.1.0,>=2.0.0 # Apache-2.0
PrettyTable<0.8,>=0.7.1 # BSD
python-keystoneclient>=3.6.0 # Apache-2.0
keystoneauth1>=2.18.0 # Apache-2.0
six>=1.9.0 # MIT
PyYAML>=3.10.0 # MIT

View File

@@ -16,7 +16,6 @@ classifier =
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
[files]
@@ -28,7 +27,7 @@ console_scripts =
watcher = watcherclient.shell:main
openstack.cli.extension =
infra_optim = watcherclient.plugin
infra_optim = watcherclient.osc.plugin
# Entry points for the 'openstack' command
openstack.infra_optim.v1 =

View File

@@ -25,5 +25,5 @@ except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=1.8'],
setup_requires=['pbr>=2.0.0'],
pbr=True)

View File

@@ -4,15 +4,16 @@
coverage>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
hacking<0.11,>=0.10.2
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
mock>=2.0 # BSD
oslosphinx>=4.7.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
python-subunit>=0.0.18 # Apache-2.0/BSD
sphinx!=1.3b1,<1.4,>=1.2.1 # BSD
sphinx>=1.5.1 # BSD
testrepository>=0.0.18 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT
tempest>=14.0.0 # Apache-2.0
# Needed for pypi packaging
wheel # MIT

24
tox.ini
View File

@@ -1,6 +1,6 @@
[tox]
minversion = 1.8
envlist = py35,py34,py27,pep8
envlist = py35,py27,pep8
skipsdist = True
[testenv]
@@ -10,6 +10,7 @@ install_command =
pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
OS_TEST_PATH=./watcherclient/tests/unit
deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}'
@@ -20,13 +21,30 @@ commands = flake8
commands = {posargs}
[testenv:cover]
commands = python setup.py testr --coverage --testr-args='{posargs}'
commands =
python setup.py testr --coverage --testr-args='{posargs}'
coverage report
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:debug]
commands = oslo_debug_helper {posargs}
commands = oslo_debug_helper -t watcherclient/tests/unit {posargs}
[testenv:functional]
basepython = python2.7
passenv =
OS_PROJECT_DOMAIN_NAME
OS_USER_DOMAIN_NAME
OS_PROJECT_NAME
OS_USERNAME
OS_PASSWORD
OS_AUTH_URL
OS_IDENTITY_API_VERSION
OS_IMAGE_API_VERSION
setenv =
OS_TEST_PATH = ./watcherclient/tests/functional
commands = python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}'
[flake8]
# E123, E125 skipped as they are invalid PEP-8.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.

View File

@@ -30,16 +30,6 @@ _C = _translators.contextual_form
# requires oslo.i18n >=2.1.0
_P = _translators.plural_form
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
def get_available_languages():
return oslo_i18n.get_available_languages(DOMAIN)

View File

@@ -18,7 +18,7 @@ import re
from oslo_utils import strutils
from watcherclient._i18n import _, _LW
from watcherclient._i18n import _
from watcherclient import exceptions
LOG = logging.getLogger(__name__)
@@ -202,8 +202,8 @@ def get_api_version(version_string):
version_string = str(version_string)
if version_string in DEPRECATED_VERSIONS:
LOG.warning(
_LW("Version %(deprecated_version)s is deprecated, using "
"alternative version %(alternative)s instead."),
"Version %(deprecated_version)s is deprecated, using "
"alternative version %(alternative)s instead.",
{"deprecated_version": version_string,
"alternative": DEPRECATED_VERSIONS[version_string]})
version_string = DEPRECATED_VERSIONS[version_string]

View File

@@ -317,7 +317,7 @@ class CrudManager(BaseManager):
def _filter_kwargs(self, kwargs):
"""Drop null values and handle ids."""
for key, ref in six.iteritems(kwargs.copy()):
for key, ref in kwargs.copy().items():
if ref is None:
kwargs.pop(key)
else:
@@ -475,7 +475,7 @@ class Resource(object):
return None
def _add_details(self, info):
for (k, v) in six.iteritems(info):
for (k, v) in info.items():
try:
setattr(self, k, v)
self._info[k] = v

View File

@@ -421,7 +421,7 @@ class HttpVersionNotSupported(HttpServerError):
# _code_map contains all the classes that have http_status attribute.
_code_map = dict(
(getattr(obj, 'http_status', None), obj)
for name, obj in six.iteritems(vars(sys.modules[__name__]))
for name, obj in vars(sys.modules[__name__]).items()
if inspect.isclass(obj) and getattr(obj, 'http_status', False)
)

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.

View File

@@ -198,7 +198,7 @@ def print_dict(dct, dict_property="Property", wrap=0):
"""
pt = prettytable.PrettyTable([dict_property, 'Value'])
pt.align = 'l'
for k, v in six.iteritems(dct):
for k, v in dct.items():
# convert dict to str to check length
if isinstance(v, dict):
v = six.text_type(v)

View File

@@ -17,7 +17,6 @@ import copy
from distutils import version
import functools
import hashlib
import json
import logging
import os
import socket
@@ -27,13 +26,14 @@ import time
from keystoneauth1 import adapter
from keystoneauth1 import exceptions as kexceptions
from oslo_serialization import jsonutils
from oslo_utils import strutils
import requests
import six
from six.moves import http_client
import six.moves.urllib.parse as urlparse
from watcherclient._i18n import _, _LE, _LW
from watcherclient._i18n import _
from watcherclient import exceptions
@@ -70,10 +70,10 @@ def _extract_error_json(body):
"""Return error_message from the HTTP response body."""
error_json = {}
try:
body_json = json.loads(body)
body_json = jsonutils.loads(body)
if 'error_message' in body_json:
raw_msg = body_json['error_message']
error_json = json.loads(raw_msg)
error_json = jsonutils.loads(raw_msg)
except ValueError:
pass
@@ -185,8 +185,8 @@ def with_retries(func):
try:
return func(self, url, method, **kwargs)
except _RETRY_EXCEPTIONS as error:
msg = (_LE("Error contacting Watcher server: %(error)s. "
"Attempt %(attempt)d of %(total)d") %
msg = ("Error contacting Watcher server: %(error)s. "
"Attempt %(attempt)d of %(total)d" %
{'attempt': attempt,
'total': num_attempts,
'error': error})
@@ -382,7 +382,7 @@ class HTTPClient(VersionNegotiationMixin):
kwargs['headers'].setdefault('Accept', 'application/json')
if 'body' in kwargs:
kwargs['body'] = json.dumps(kwargs['body'])
kwargs['body'] = jsonutils.dumps(kwargs['body'])
resp, body_iter = self._http_request(url, method, **kwargs)
content_type = resp.headers.get('Content-Type')
@@ -395,9 +395,9 @@ class HTTPClient(VersionNegotiationMixin):
if 'application/json' in content_type:
body = ''.join([chunk for chunk in body_iter])
try:
body = json.loads(body)
body = jsonutils.loads(body)
except ValueError:
LOG.error(_LE('Could not decode response body as JSON'))
LOG.error('Could not decode response body as JSON')
else:
body = None
@@ -545,7 +545,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
kwargs['headers'].setdefault('Accept', 'application/json')
if 'body' in kwargs:
kwargs['data'] = json.dumps(kwargs.pop('body'))
kwargs['data'] = jsonutils.dumps(kwargs.pop('body'))
resp = self._http_request(url, method, **kwargs)
body = resp.content
@@ -558,7 +558,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
try:
body = resp.json()
except ValueError:
LOG.error(_LE('Could not decode response body as JSON'))
LOG.error('Could not decode response body as JSON')
else:
body = None
@@ -602,8 +602,8 @@ def _construct_http_client(endpoint=None,
dvars = [k for k, v in ignored.items() if v]
if dvars:
LOG.warning(_LW('The following arguments are ignored when using '
'the session to construct a client: %s'),
LOG.warning('The following arguments are ignored when using '
'the session to construct a client: %s',
', '.join(dvars))
return SessionClient(session=session,
@@ -615,8 +615,8 @@ def _construct_http_client(endpoint=None,
**kwargs)
else:
if kwargs:
LOG.warning(_LW('The following arguments are being ignored when '
'constructing the client: %s'), ', '.join(kwargs))
LOG.warning('The following arguments are being ignored when '
'constructing the client: %s', ', '.join(kwargs))
return HTTPClient(endpoint=endpoint,
token=token,

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
@@ -18,11 +17,11 @@
from __future__ import print_function
import argparse
import json
import os
import uuid
import yaml
from oslo_serialization import jsonutils
from oslo_utils import importutils
from watcherclient._i18n import _
@@ -90,7 +89,7 @@ def split_and_deserialize(string):
raise exc.CommandError(_('Attributes must be a list of '
'PATH=VALUE not "%s"') % string)
try:
value = json.loads(value)
value = jsonutils.loads(value)
except ValueError:
pass

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain

View File

@@ -25,7 +25,7 @@ from cliff import command
from cliff import commandmanager
from cliff import complete
from cliff import help as cli_help
from keystoneclient import session
from keystoneauth1 import loading
from osc_lib import logs
from osc_lib import utils
@@ -165,7 +165,7 @@ class WatcherShell(app.App):
"Service Catalog.")
parser.epilog = ('See "watcher help COMMAND" for help '
'on a specific command.')
session.Session.register_cli_options(parser)
loading.register_session_argparse_arguments(parser)
return parser
def configure_logging(self):

View File

@@ -0,0 +1,61 @@
..
Except where otherwise noted, this document is licensed under Creative
Commons Attribution 3.0 License. You can view the license at:
https://creativecommons.org/licenses/by/3.0/
=======
Testing
=======
.. _functional_tests:
Functional tests
================
The following procedure gets you started with Tempest testing but you can also
refer to the `Tempest documentation`_ for more details.
.. _Tempest documentation: http://docs.openstack.org/developer/tempest/
Tempest installation
--------------------
You need to install virtualenv, create a virtual environment and activate it::
$ pip install virtualenv
$ virtualenv watcher-env
$ source watcher-env/bin/activate
Then, to install Tempest you can issue the following commands::
$ git clone https://github.com/openstack/tempest/
$ pip install tempest/
There should be set environment variables using the OpenStack RC file. If
you don't have RC file yet, create ``admin-openrc`` file and fill it using
the following example::
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL=http://controller:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
Then, save file and execute ``source admin-openrc`` to set environment
variables.
To run functional tests you need to go to python-watcherclient folder, install
all requirements and execute ``tempest run`` command::
$ pip install -r requirements.txt test-requirements.txt
$ pip install .
$ tempest run --regex watcherclient.tests.functional
You can run specified test(s) by using regular expression::
$ tempest run --regex watcherclient.tests.functional.v1.test_action.ActionTests.test_action_list

View File

@@ -0,0 +1,108 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import re
import shlex
import subprocess
import testtools
import six
from tempest.lib.cli import output_parser
from tempest.lib import exceptions
def execute(cmd, fail_ok=False, merge_stderr=False):
"""Executes specified command for the given action."""
cmdlist = shlex.split(cmd)
stdout = subprocess.PIPE
stderr = subprocess.STDOUT if merge_stderr else subprocess.PIPE
proc = subprocess.Popen(cmdlist, stdout=stdout, stderr=stderr)
result, result_err = proc.communicate()
result = result.decode('utf-8')
if not fail_ok and proc.returncode != 0:
raise exceptions.CommandFailed(proc.returncode, cmd, result,
result_err)
return result
class TestCase(testtools.TestCase):
delimiter_line = re.compile('^\+\-[\+\-]+\-\+$')
@classmethod
def watcher(cls, cmd, fail_ok=False):
"""Executes watcherclient command for the given action."""
return execute('watcher {0}'.format(cmd), fail_ok=fail_ok)
@classmethod
def get_opts(cls, fields, format='value'):
return ' -f {0} {1}'.format(format,
' '.join(['-c ' + it for it in fields]))
@classmethod
def assertOutput(cls, expected, actual):
if expected != actual:
raise Exception('{0} != {1}'.format(expected, actual))
@classmethod
def assertInOutput(cls, expected, actual):
if expected not in actual:
raise Exception('{0} not in {1}'.format(expected, actual))
def assert_table_structure(self, items, field_names):
"""Verify that all items have keys listed in field_names."""
for item in items:
for field in field_names:
self.assertIn(field, item)
def assert_show_fields(self, items, field_names):
"""Verify that all items have keys listed in field_names."""
for item in items:
for key in six.iterkeys(item):
self.assertIn(key, field_names)
def assert_show_structure(self, items, field_names):
"""Verify that all field_names listed in keys of all items."""
if isinstance(items, list):
o = {}
for d in items:
o.update(d)
else:
o = items
item_keys = o.keys()
for field in field_names:
self.assertIn(field, item_keys)
@staticmethod
def parse_show_as_object(raw_output):
"""Return a dict with values parsed from cli output."""
items = TestCase.parse_show(raw_output)
o = {}
for item in items:
o.update(item)
return o
@staticmethod
def parse_show(raw_output):
"""Return list of dicts with item values parsed from cli output."""
items = []
table_ = output_parser.table(raw_output)
for row in table_['values']:
item = {}
item[row[0]] = row[1]
items.append(item)
return items
def parse_listing(self, raw_output):
"""Return list of dicts with basic item parsed from cli output."""
return output_parser.listing(raw_output)

View File

@@ -0,0 +1,71 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_utils import uuidutils
from watcherclient.tests.functional.v1 import base
class ActionTests(base.TestCase):
"""Functional tests for action."""
dummy_name = 'dummy'
list_fields = ['UUID', 'Parents', 'State', 'Action Plan', 'Action']
detailed_list_fields = list_fields + ['Created At', 'Updated At',
'Deleted At', 'Parameters']
audit_template_name = 'a' + uuidutils.generate_uuid()
audit_uuid = None
@classmethod
def setUpClass(cls):
template_raw_output = cls.watcher(
'audittemplate create %s dummy -s dummy' % cls.audit_template_name)
template_output = cls.parse_show_as_object(template_raw_output)
audit_raw_output = cls.watcher(
'audit create -a %s' % template_output['Name'])
audit_output = cls.parse_show_as_object(audit_raw_output)
cls.audit_uuid = audit_output['UUID']
@classmethod
def tearDownClass(cls):
# Delete Action Plan and all related actions.
output = cls.parse_show(
cls.watcher('actionplan list --audit %s' % cls.audit_uuid))
action_plan_uuid = output[0].keys()[0]
raw_output = cls.watcher('actionplan delete %s' % action_plan_uuid)
cls.assertOutput('', raw_output)
# Delete audit
raw_output = cls.watcher('audit delete %s' % cls.audit_uuid)
cls.assertOutput('', raw_output)
# Delete Template
raw_output = cls.watcher(
'audittemplate delete %s' % cls.audit_template_name)
cls.assertOutput('', raw_output)
def test_action_list(self):
raw_output = self.watcher('action list')
self.assert_table_structure([raw_output], self.list_fields)
def test_action_detailed_list(self):
raw_output = self.watcher('action list --detail')
self.assert_table_structure([raw_output], self.detailed_list_fields)
def test_action_show(self):
action_list = self.parse_show(self.watcher('action list'))
action_uuid = action_list[0].keys()[0]
action = self.watcher('action show ' + action_uuid)
self.assertIn(action_uuid, action)
self.assert_table_structure([action],
self.detailed_list_fields)

View File

@@ -0,0 +1,122 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_utils import uuidutils
from watcherclient.tests.functional.v1 import base
class ActionPlanTests(base.TestCase):
"""Functional tests for action plan."""
dummy_name = 'dummy'
list_fields = ['UUID', 'Audit', 'State', 'Updated At', 'Global efficacy']
detailed_list_fields = list_fields + ['Created At', 'Deleted At',
'Strategy', 'Efficacy indicators']
audit_template_name = 'a' + uuidutils.generate_uuid()
audit_uuid = None
@classmethod
def setUpClass(cls):
template_raw_output = cls.watcher(
'audittemplate create %s dummy -s dummy' % cls.audit_template_name)
template_output = cls.parse_show_as_object(template_raw_output)
audit_raw_output = cls.watcher('audit create -a %s'
% template_output['Name'])
audit_output = cls.parse_show_as_object(audit_raw_output)
cls.audit_uuid = audit_output['UUID']
@classmethod
def tearDownClass(cls):
# Delete action plan
output = cls.parse_show(
cls.watcher('actionplan list --audit %s' % cls.audit_uuid))
action_plan_uuid = output[0].keys()[0]
raw_output = cls.watcher('actionplan delete %s' % action_plan_uuid)
cls.assertOutput('', raw_output)
# Delete audit
raw_output = cls.watcher('audit delete %s' % cls.audit_uuid)
cls.assertOutput('', raw_output)
# Delete Template
raw_output = cls.watcher(
'audittemplate delete %s' % cls.audit_template_name)
cls.assertOutput('', raw_output)
def test_action_plan_list(self):
raw_output = self.watcher('actionplan list')
self.assert_table_structure([raw_output], self.list_fields)
def test_action_plan_detailed_list(self):
raw_output = self.watcher('actionplan list --detail')
self.assert_table_structure([raw_output], self.detailed_list_fields)
def test_action_plan_show(self):
action_plan_list = self.parse_show(self.watcher('actionplan list'))
action_plan_uuid = action_plan_list[0].keys()[0]
actionplan = self.watcher('actionplan show %s' % action_plan_uuid)
self.assertIn(action_plan_uuid, actionplan)
self.assert_table_structure([actionplan],
self.detailed_list_fields)
def test_action_plan_start(self):
output = self.parse_show(self.watcher('actionplan list --audit %s'
% self.audit_uuid))
action_plan_uuid = output[0].keys()[0]
self.watcher('actionplan start %s' % action_plan_uuid)
raw_output = self.watcher('actionplan show %s' % action_plan_uuid)
self.assert_table_structure([raw_output], self.detailed_list_fields)
class ActionPlanActiveTests(base.TestCase):
audit_uuid = None
audit_template_name = 'b' + uuidutils.generate_uuid()
list_fields = ['UUID', 'Audit', 'State', 'Updated At', 'Global efficacy']
detailed_list_fields = list_fields + ['Created At', 'Deleted At',
'Strategy', 'Efficacy indicators']
def _delete_action_plan(self):
output = self.parse_show(
self.watcher('actionplan list --audit %s' % self.audit_uuid))
action_plan_uuid = output[0].keys()[0]
raw_output = self.watcher('actionplan delete %s' % action_plan_uuid)
self.assertOutput('', raw_output)
def _delete_audit(self):
raw_output = self.watcher('audit delete %s' % self.audit_uuid)
self.assertOutput('', raw_output)
def _delete_audit_template(self):
raw_output = self.watcher(
'audittemplate delete %s' % self.audit_template_name)
self.assertOutput('', raw_output)
def _create_audit_template(self):
template_raw_output = self.watcher(
'audittemplate create %s dummy -s dummy'
% self.audit_template_name)
template_output = self.parse_show_as_object(template_raw_output)
return template_output
def test_action_plan_create(self):
template_output = self._create_audit_template()
action_plan = self.watcher(
'actionplan create -a %s' % template_output['Name'])
self.audit_uuid = self.parse_show_as_object(action_plan)['UUID']
self.assert_table_structure([action_plan], self.detailed_list_fields)
self._delete_action_plan()
self._delete_audit()
self._delete_audit_template()

View File

@@ -0,0 +1,113 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_utils import uuidutils
from watcherclient.tests.functional.v1 import base
class AuditTests(base.TestCase):
"""Functional tests for audit."""
dummy_name = 'dummy'
list_fields = ['UUID', 'Audit Type', 'State', 'Goal', 'Strategy']
detailed_list_fields = list_fields + ['Created At', 'Updated At',
'Deleted At', 'Parameters',
'Interval', 'Audit Scope']
audit_template_name = 'a' + uuidutils.generate_uuid()
audit_uuid = None
@classmethod
def setUpClass(cls):
raw_output = cls.watcher('audittemplate create %s dummy -s dummy'
% cls.audit_template_name)
template_output = cls.parse_show_as_object(raw_output)
audit_raw_output = cls.watcher(
'audit create -a %s' % template_output['Name'])
audit_output = cls.parse_show_as_object(audit_raw_output)
cls.audit_uuid = audit_output['UUID']
@classmethod
def tearDownClass(cls):
output = cls.parse_show(
cls.watcher('actionplan list --audit %s' % cls.audit_uuid))
action_plan_uuid = output[0].keys()[0]
cls.watcher('actionplan delete %s' % action_plan_uuid)
cls.watcher('audit delete %s' % cls.audit_uuid)
cls.watcher('audittemplate delete %s' % cls.audit_template_name)
def test_audit_list(self):
raw_output = self.watcher('audit list')
self.assert_table_structure([raw_output], self.list_fields)
def test_audit_detailed_list(self):
raw_output = self.watcher('audit list --detail')
self.assert_table_structure([raw_output], self.detailed_list_fields)
def test_audit_show(self):
audit = self.watcher('audit show ' + self.audit_uuid)
self.assertIn(self.audit_uuid, audit)
self.assert_table_structure([audit], self.detailed_list_fields)
def test_audit_update(self):
audit_raw_output = self.watcher('audit update %s add interval=2'
% self.audit_uuid)
audit_output = self.parse_show_as_object(audit_raw_output)
assert int(audit_output['Interval']) == 2
class AuditActiveTests(base.TestCase):
list_fields = ['UUID', 'Audit Type', 'State', 'Goal', 'Strategy']
detailed_list_fields = list_fields + ['Created At', 'Updated At',
'Deleted At', 'Parameters',
'Interval', 'Audit Scope']
audit_template_name = 'a' + uuidutils.generate_uuid()
audit_uuid = None
def _create_audit(self):
raw_output = self.watcher('audittemplate create %s dummy -s dummy'
% self.audit_template_name)
template_output = self.parse_show_as_object(raw_output)
self.audit_uuid = self.parse_show_as_object(
self.watcher('audit create -a %s'
% template_output['Name']))['UUID']
def _delete_audit(self):
output = self.parse_show(
self.watcher('actionplan list --audit %s' % self.audit_uuid))
action_plan_uuid = output[0].keys()[0]
self.watcher('actionplan delete %s' % action_plan_uuid)
self.watcher('audit delete %s' % self.audit_uuid)
self.watcher('audittemplate delete %s' % self.audit_template_name)
def test_create_audit(self):
raw_output = self.watcher('audittemplate create %s dummy -s dummy'
% self.audit_template_name)
template_output = self.parse_show_as_object(raw_output)
audit = self.watcher('audit create -a %s' % template_output['Name'])
self.audit_uuid = self.parse_show_as_object(audit)['UUID']
self.assert_table_structure([audit], self.detailed_list_fields)
self._delete_audit()
def test_delete_audit(self):
self._create_audit()
raw_output = self.watcher('audit delete %s' % self.audit_uuid)
self.assertOutput('', raw_output)
output = self.parse_show(
self.watcher('actionplan list --audit %s' % self.audit_uuid))
action_plan_uuid = output[0].keys()[0]
self.watcher('actionplan delete %s' % action_plan_uuid)
self.watcher('audittemplate delete %s' % self.audit_template_name)

View File

@@ -0,0 +1,89 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_utils import uuidutils
from watcherclient.tests.functional.v1 import base
class AuditTemplateTests(base.TestCase):
"""Functional tests for audit template."""
dummy_name = 'dummy'
list_fields = ['UUID', 'Name', 'Goal', 'Strategy']
detailed_list_fields = list_fields + ['Created At', 'Updated At',
'Deleted At', 'Description',
'Audit Scope']
audit_template_name = 'a' + uuidutils.generate_uuid()
@classmethod
def setUpClass(cls):
cls.watcher('audittemplate create %s dummy -s dummy'
% cls.audit_template_name)
@classmethod
def tearDownClass(cls):
cls.watcher('audittemplate delete %s' % cls.audit_template_name)
def test_audit_template_list(self):
raw_output = self.watcher('audittemplate list')
self.assert_table_structure([raw_output], self.list_fields)
def test_audit_template_detailed_list(self):
raw_output = self.watcher('audittemplate list --detail')
self.assert_table_structure([raw_output], self.detailed_list_fields)
def test_audit_template_show(self):
audit_template = self.watcher(
'audittemplate show %s' % self.audit_template_name)
self.assertIn(self.audit_template_name, audit_template)
self.assert_table_structure([audit_template],
self.detailed_list_fields)
def test_audit_template_update(self):
raw_output = self.watcher('audittemplate update %s replace '
'description="Updated Desc"'
% self.audit_template_name)
audit_template_output = self.parse_show_as_object(raw_output)
assert audit_template_output['Description'] == 'Updated Desc'
class AuditTemplateActiveTests(base.TestCase):
audit_template_name = 'b' + uuidutils.generate_uuid()
list_fields = ['UUID', 'Name', 'Goal', 'Strategy']
detailed_list_fields = list_fields + ['Created At', 'Updated At',
'Deleted At', 'Description',
'Audit Scope']
def _create_audit_template(self):
self.watcher('audittemplate create %s dummy -s dummy '
'-d "Test Audit Template"' % self.audit_template_name)
def _delete_audit_template(self):
self.watcher('audittemplate delete %s' % self.audit_template_name)
def test_create_audit_template(self):
raw_output = self.watcher('audittemplate create %s dummy '
'-s dummy -d "Test Audit Template"'
% self.audit_template_name)
self.assert_table_structure([raw_output], self.detailed_list_fields)
self._delete_audit_template()
def test_delete_audit_template(self):
self._create_audit_template()
raw_output = self.watcher('audittemplate delete %s'
% self.audit_template_name)
self.assertOutput('', raw_output)

View File

@@ -0,0 +1,41 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from watcherclient.tests.functional.v1 import base
class GoalTests(base.TestCase):
"""Functional tests for goal."""
dummy_name = 'dummy'
list_fields = ['UUID', 'Name', 'Display name']
def test_goal_list(self):
raw_output = self.watcher('goal list')
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure([raw_output], self.list_fields)
def test_goal_detailed_list(self):
raw_output = self.watcher('goal list --detail')
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure(
[raw_output], self.list_fields + ['Efficacy specification'])
def test_goal_show(self):
raw_output = self.watcher('goal show %s' % self.dummy_name)
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure(
[raw_output], self.list_fields + ['Efficacy specification'])
self.assertNotIn('server_consolidation', raw_output)

View File

@@ -0,0 +1,40 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from watcherclient.tests.functional.v1 import base
class ScoringEngineTests(base.TestCase):
"""Functional tests for scoring engine."""
dummy_name = 'dummy_scorer'
list_fields = ['UUID', 'Name', 'Description']
detailed_list_fields = list_fields + ['Metainfo']
def test_scoringengine_list(self):
raw_output = self.watcher('scoringengine list')
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure([raw_output], self.list_fields)
def test_scoringengine_detailed_list(self):
raw_output = self.watcher('scoringengine list --detail')
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure([raw_output], self.detailed_list_fields)
def test_scoringengine_show(self):
raw_output = self.watcher('scoringengine show %s' % self.dummy_name)
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure([raw_output], self.detailed_list_fields)
self.assertNotIn('dummy_avg_scorer', raw_output)

View File

@@ -0,0 +1,45 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from watcherclient.tests.functional.v1 import base
class ServiceTests(base.TestCase):
"""Functional tests for service."""
decision_engine_name = 'watcher-decision-engine'
applier_name = 'watcher-applier'
list_fields = ['ID', 'Name', 'Host', 'Status']
def test_service_list(self):
raw_output = self.watcher('service list')
self.assertIn(self.decision_engine_name, raw_output)
self.assertIn(self.applier_name, raw_output)
self.assert_table_structure([raw_output], self.list_fields)
def test_service_detailed_list(self):
raw_output = self.watcher('service list --detail')
self.assertIn(self.decision_engine_name, raw_output)
self.assertIn(self.applier_name, raw_output)
self.assert_table_structure([raw_output],
self.list_fields + ['Last seen up'])
def test_service_show(self):
raw_output = self.watcher('service show %s'
% self.decision_engine_name)
self.assertIn(self.decision_engine_name, raw_output)
self.assert_table_structure([raw_output],
self.list_fields + ['Last seen up'])
self.assertNotIn(self.applier_name, raw_output)

View File

@@ -0,0 +1,41 @@
# Copyright (c) 2016 Servionica
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from watcherclient.tests.functional.v1 import base
class StrategyTests(base.TestCase):
"""Functional tests for strategy."""
dummy_name = 'dummy'
list_fields = ['UUID', 'Name', 'Display name', 'Goal']
def test_strategy_list(self):
raw_output = self.watcher('strategy list')
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure([raw_output], self.list_fields)
def test_strategy_detailed_list(self):
raw_output = self.watcher('strategy list --detail')
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure([raw_output],
self.list_fields + ['Parameters spec'])
def test_strategy_show(self):
raw_output = self.watcher('strategy show %s' % self.dummy_name)
self.assertIn(self.dummy_name, raw_output)
self.assert_table_structure([raw_output],
self.list_fields + ['Parameters spec'])
self.assertNotIn('basic', raw_output)

View File

View File

@@ -17,7 +17,7 @@ import mock
from watcherclient.common import api_versioning
from watcherclient import exceptions
from watcherclient.tests import utils
from watcherclient.tests.unit import utils
class APIVersionTestCase(utils.BaseTestCase):
@@ -82,12 +82,12 @@ class APIVersionTestCase(utils.BaseTestCase):
v4 = api_versioning.APIVersion("2.0")
v_null = api_versioning.APIVersion()
self.assertTrue(v1 < v2)
self.assertTrue(v3 > v2)
self.assertTrue(v1 != v2)
self.assertTrue(v1 == v4)
self.assertTrue(v1 != v_null)
self.assertTrue(v_null == v_null)
self.assertLess(v1, v2)
self.assertGreater(v3, v2)
self.assertNotEqual(v1, v2)
self.assertEqual(v1, v4)
self.assertNotEqual(v1, v_null)
self.assertEqual(v_null, v_null)
self.assertRaises(TypeError, v1.__le__, "2.1")
def test_version_matches(self):

View File

@@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import uuid
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from keystoneclient.fixture import v2 as ks_v2_fixture
from keystoneclient.fixture import v3 as ks_v3_fixture
from keystoneauth1.fixture import v2 as ks_v2_fixture
from keystoneauth1.fixture import v3 as ks_v3_fixture
# these are copied from python-keystoneclient tests
BASE_HOST = 'http://keystone.example.com'
@@ -49,15 +49,15 @@ V3_VERSION = {'id': 'v3.0',
'status': 'stable',
'updated': UPDATED}
TOKENID = uuid.uuid4().hex
TOKENID = uuidutils.generate_uuid(dashed=False)
def _create_version_list(versions):
return json.dumps({'versions': {'values': versions}})
return jsonutils.dumps({'versions': {'values': versions}})
def _create_single_version(version):
return json.dumps({'version': version})
return jsonutils.dumps({'version': version})
V3_VERSION_LIST = _create_version_list([V3_VERSION, V2_VERSION])
@@ -74,8 +74,8 @@ def keystone_request_callback(request, uri, headers):
return (200, headers, V3_VERSION_LIST)
elif uri == BASE_URL + "/v2.0":
v2_token = ks_v2_fixture.Token(token_id)
return (200, response_headers, json.dumps(v2_token))
return (200, response_headers, jsonutils.dumps(v2_token))
elif uri == BASE_URL + "/v3":
v3_token = ks_v3_fixture.Token()
response_headers["X-Subject-Token"] = token_id
return (201, response_headers, json.dumps(v3_token))
return (201, response_headers, jsonutils.dumps(v3_token))

View File

@@ -17,7 +17,7 @@ from keystoneauth1 import loading as kaloading
from watcherclient import client as watcherclient
from watcherclient.common import httpclient
from watcherclient import exceptions
from watcherclient.tests import utils
from watcherclient.tests.unit import utils
class ClientTest(utils.BaseTestCase):

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -12,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from watcherclient.tests import utils
from watcherclient.tests.unit import utils
module_str = 'watcherclient'

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright 2013 OpenStack LLC.
# All Rights Reserved.
@@ -19,7 +18,7 @@ import mock
from watcherclient.common.apiclient import exceptions as exc
from watcherclient.common import utils
from watcherclient.tests import utils as test_utils
from watcherclient.tests.unit import utils as test_utils
class UtilsTest(test_utils.BaseTestCase):

View File

View File

@@ -1,4 +1,3 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2016 b<>com
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import shlex
import mock
from osc_lib import utils as oscutils
from oslo_serialization import jsonutils
from watcherclient.common import httpclient
from watcherclient.tests import utils
from watcherclient.tests.unit import utils
class CommandTestCase(utils.BaseTestCase):
@@ -56,7 +55,7 @@ class CommandTestCase(utils.BaseTestCase):
def run_cmd(self, cmd, formatting='json'):
if formatting:
formatter_arg = " -f %s" % formatting
formatter = json.loads
formatter = jsonutils.loads
else:
formatter_arg = ''
formatter = str

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2013 Red Hat, Inc.
# All Rights Reserved.
#
@@ -18,7 +16,7 @@
import testtools
from testtools import matchers
from watcherclient.tests import utils
from watcherclient.tests.unit import utils
import watcherclient.v1.action
ACTION1 = {

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2013 Red Hat, Inc.
# All Rights Reserved.
#
@@ -20,7 +18,7 @@ import copy
import testtools
from testtools import matchers
from watcherclient.tests import utils
from watcherclient.tests.unit import utils
import watcherclient.v1.action_plan
ACTION_PLAN1 = {

View File

@@ -1,4 +1,3 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2016 b<>com
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,13 +14,12 @@
# limitations under the License.
import datetime
import mock
import six
from watcherclient import exceptions
from watcherclient import shell
from watcherclient.tests.v1 import base
from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource
from watcherclient.v1 import resource_fields

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright 2013 IBM Corp
#
@@ -15,13 +14,12 @@
# under the License.
import datetime
import mock
import six
from watcherclient import exceptions
from watcherclient import shell
from watcherclient.tests.v1 import base
from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource
from watcherclient.v1 import resource_fields
@@ -30,7 +28,7 @@ ACTION_1 = {
'action_plan_uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2',
'state': 'PENDING',
'action_type': 'migrate',
'next_uuid': '239f02a5-9649-4e14-9d33-ac2bf67cb755',
'parents': ['239f02a5-9649-4e14-9d33-ac2bf67cb755'],
'input_parameters': {"test": 1},
'created_at': datetime.datetime.now().isoformat(),
'updated_at': None,
@@ -42,7 +40,7 @@ ACTION_2 = {
'action_plan_uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2',
'state': 'PENDING',
'action_type': 'migrate',
'next_uuid': '67653274-eb24-c7ba-70f6-a84e73d80843',
'parents': ['67653274-eb24-c7ba-70f6-a84e73d80843'],
'input_parameters': {"test": 2},
'created_at': datetime.datetime.now().isoformat(),
'updated_at': None,
@@ -52,7 +50,7 @@ ACTION_2 = {
ACTION_3 = {
'uuid': '67653274-eb24-c7ba-70f6-a84e73d80843',
'action_plan_uuid': 'a5199d0e-0702-4613-9234-5ae2af8dafea',
'next_uuid': None,
'parents': [],
'state': 'PENDING',
'action_type': 'sleep',
'created_at': datetime.datetime.now().isoformat(),

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2013 Red Hat, Inc.
# All Rights Reserved.
#
@@ -20,7 +18,7 @@ import copy
import testtools
from testtools import matchers
from watcherclient.tests import utils
from watcherclient.tests.unit import utils
import watcherclient.v1.audit
@@ -127,6 +125,26 @@ fake_responses_sorting = {
},
}
fake_responses_goal = {
'/v1/audits/?goal=dummy':
{
'GET': (
{},
{"audits": [AUDIT2, AUDIT1]}
),
},
}
fake_responses_strategy = {
'/v1/audits/?strategy=dummy':
{
'GET': (
{},
{"audits": [AUDIT1]}
),
},
}
class AuditManagerTest(testtools.TestCase):
def setUp(self):
@@ -191,6 +209,26 @@ class AuditManagerTest(testtools.TestCase):
self.assertEqual(expect, self.api.calls)
self.assertEqual(2, len(audits))
def test_audits_list_goal(self):
self.api = utils.FakeAPI(fake_responses_goal)
self.mgr = watcherclient.v1.audit.AuditManager(self.api)
audits = self.mgr.list(goal='dummy')
expect = [
('GET', '/v1/audits/?goal=dummy', {}, None)
]
self.assertEqual(expect, self.api.calls)
self.assertEqual(2, len(audits))
def test_audits_list_strategy(self):
self.api = utils.FakeAPI(fake_responses_strategy)
self.mgr = watcherclient.v1.audit.AuditManager(self.api)
audits = self.mgr.list(strategy='dummy')
expect = [
('GET', '/v1/audits/?strategy=dummy', {}, None)
]
self.assertEqual(expect, self.api.calls)
self.assertEqual(1, len(audits))
def test_audits_show(self):
audit = self.mgr.get(AUDIT1['uuid'])
expect = [

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Copyright 2013 IBM Corp
#
@@ -15,13 +14,12 @@
# under the License.
import datetime
import mock
import six
from watcherclient import exceptions
from watcherclient import shell
from watcherclient.tests.v1 import base
from watcherclient.tests.unit.v1 import base
from watcherclient import v1 as resource
from watcherclient.v1 import resource_fields
@@ -69,6 +67,7 @@ AUDIT_1 = {
'parameters': None,
'interval': None,
'scope': '',
'auto_trigger': False,
}
AUDIT_2 = {
@@ -78,13 +77,14 @@ AUDIT_2 = {
'audit_template_uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2',
'audit_template_name': 'at1',
'goal_name': 'fc087747-61be-4aad-8126-b701731ae836',
'strategy_name': None,
'strategy_name': 'auto',
'created_at': datetime.datetime.now().isoformat(),
'updated_at': None,
'deleted_at': None,
'parameters': None,
'interval': None,
'scope': '',
'auto_trigger': False,
}
AUDIT_3 = {
@@ -94,13 +94,14 @@ AUDIT_3 = {
'audit_template_uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2',
'audit_template_name': 'at1',
'goal_name': None,
'strategy_name': None,
'strategy_name': 'auto',
'created_at': datetime.datetime.now().isoformat(),
'updated_at': None,
'deleted_at': None,
'parameters': None,
'interval': 3600,
'scope': '',
'auto_trigger': True,
}
@@ -284,7 +285,7 @@ class AuditShellTest(base.CommandTestCase):
result)
self.m_audit_mgr.create.assert_called_once_with(
audit_template_uuid='f8e47706-efcf-49a4-a5c4-af604eb492f2',
audit_type='ONESHOT')
audit_type='ONESHOT', auto_trigger=False)
def test_do_audit_create_with_audit_template_name(self):
audit = resource.Audit(mock.Mock(), AUDIT_3)
@@ -300,6 +301,7 @@ class AuditShellTest(base.CommandTestCase):
result)
self.m_audit_mgr.create.assert_called_once_with(
audit_template_uuid='f8e47706-efcf-49a4-a5c4-af604eb492f2',
auto_trigger=False,
audit_type='ONESHOT')
def test_do_audit_create_with_goal(self):
@@ -315,6 +317,7 @@ class AuditShellTest(base.CommandTestCase):
result)
self.m_audit_mgr.create.assert_called_once_with(
goal='fc087747-61be-4aad-8126-b701731ae836',
auto_trigger=False,
audit_type='ONESHOT'
)
@@ -333,6 +336,7 @@ class AuditShellTest(base.CommandTestCase):
self.m_audit_mgr.create.assert_called_once_with(
goal='fc087747-61be-4aad-8126-b701731ae836',
strategy='2cf86250-d309-4b81-818e-1537f3dba6e5',
auto_trigger=False,
audit_type='ONESHOT'
)
@@ -349,7 +353,7 @@ class AuditShellTest(base.CommandTestCase):
result)
self.m_audit_mgr.create.assert_called_once_with(
goal='fc087747-61be-4aad-8126-b701731ae836',
audit_type='ONESHOT')
auto_trigger=False, audit_type='ONESHOT')
def test_do_audit_create_with_parameter(self):
audit = resource.Audit(mock.Mock(), AUDIT_1)
@@ -366,6 +370,7 @@ class AuditShellTest(base.CommandTestCase):
self.m_audit_mgr.create.assert_called_once_with(
goal='fc087747-61be-4aad-8126-b701731ae836',
audit_type='ONESHOT',
auto_trigger=False,
parameters={'para1': 10, 'para2': 20})
def test_do_audit_create_with_type_continuous(self):
@@ -383,4 +388,5 @@ class AuditShellTest(base.CommandTestCase):
self.m_audit_mgr.create.assert_called_once_with(
goal='fc087747-61be-4aad-8126-b701731ae836',
audit_type='CONTINUOUS',
auto_trigger=False,
interval='3600')

Some files were not shown because too many files have changed in this diff Show More