Commit Graph

13 Commits

Author SHA1 Message Date
Anton Arefiev 3fe42b53fd SQLAlchemy 2.0 Support
Primarily remove the workaround added in
Ia6d512ff2ae417bab938cb095fbb0884d195010a which added
continued use of autocommit, which is incompatible with
SQLAlchemy 2.0.

Also set the environment for unit tests to report compatability
warnings, although it appears none are being reported at this time.

Also cuts out the db upgrade cruft to only use the online database
migration code through oslo_db's enginefacade, which has the smarts
to handle online or offline migrations.

And then, retools unit/functional test data storage to utlize sqlite,
and in that re-tooled the queries to prevent locking conditions
which could exist with queries, and some additional refactoring/cleanup.

Also, don't mock and test time.sleep().

Additionally, it looks like we have discovered the root cause of the
memory/connection leakage issue which has been observed, due to the
way lists of nodes are processed/returned.

This change was based upon the work in
I506da42a9891a245831f325e34bec92e0a3f33f0 which is included in
this commit as the entire database structure and interaction
has been modified for ironic-inspector.

Co-Authored-By: aarefiev <aarefiev@mirantis.com>
Story: 2009727
Task: 44132
Change-Id: Ic88eb9dec5fddc924a72d9a23c17a304954ebf46
2022-12-15 09:28:55 -08:00
Sean McGinnis a9f7f67de5
Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Ic67f09a223ae2d0cb460771a10a4122307afa05b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-18 16:15:28 -05:00
Zygimantas Matonis e2c8f9fd7b Added scope to introspection rules.
Added 'scope' property to IntrospectionRule and logic to check if a node
falls in the same scope.This allows introspection rules to be applied on
selected nodes instead of every one of them.

Story: 2006995
Task: 37763

Change-Id: I77034f032ea0ec16886afdd928546eb801f7a90a
2020-03-26 21:40:43 +01:00
Iury Gregory Melo Ferreira 22294abac6 Accept None value for set-attribute
Allows the ``set-attribute`` introspection rule action
to use ``None`` as a valid value.

Co-Authored-By: Riccardo Pittau <elfosardo@gmail.com>

Change-Id: I1aa11c8095c4557107223e352424e3b718e2ab35
Story: #2004546
Task: #28299
2018-12-07 15:12:17 +01:00
Will Miller 0646970f58 Allow nested action value formatting
Modify introspection rules to allow formatting to be applied to strings
nested in dicts and lists in the actions.

Change-Id: Ia53e0de98438f7789e9b9136dcd85c1b1274b713
Story: #1670768
Task: #11362
2018-08-01 09:32:59 +01:00
Jenkins 7a0be9aeb0 Merge "Remove rollback support from introspection rules" 2017-05-18 15:24:48 +00:00
Dmitry Tantsur 5a40f24584 Remove rollback support from introspection rules
It was deprecated more than a year ago.

Change-Id: Ibf12960ac7208acb290f2f48de4cec6fef299dc5
Related-Bug: #1686942
2017-05-17 18:33:34 +02:00
Jenkins 65945d1086 Merge "Inspector rules API does not return all attributes" 2017-05-17 15:35:40 +00:00
Dmitry Tantsur ce4fb10115 Do not fail rules rollback on bad formatting key
The reason we're running rollback may be because some keys are not present.
We don't want to fail due to that, see bug 1686942 for an example.

Change-Id: Iac242df9987f1ce0c7a6db4f70440fa8f2aabc46
Closes-Bug: #1686942
2017-05-16 16:47:00 +02:00
Annie Lezil 33a28f34f8 Inspector rules API does not return all attributes
When using the Inspector rules API to query existing introspection
rules, inspector does not return 'invert' or 'multiple' attributes of
conditions associated with the rules.

Change-Id: I08606cea676ecf57bbb3b73077c4832240fbe0d2
Closes-Bug: #1670372
2017-05-05 20:01:53 +02:00
Moshe Levi 027642246f Replace assertRaisesRegexp with assertRaisesRegex
assertRaisesRegexp is deprecated in python3
https://docs.python.org/3.2/library/unittest.html

Co-Authored-By: edan david <edand@mellanox.com>

Change-Id: I9446e745239d64ac9adf8fd1a8f95b5befc8cf06
2016-09-05 08:57:47 -04:00
Zhenguo Niu 9b4116a1ae Check whether action value is string before calling format()
AttributeError: 'int' object has no attribute 'format' will be raised
if we pass an integer value, so we should check whether the value is
a string or not.

Change-Id: I14ed4d404a9be1233493083bef49218cf0f45867
Closes-Bug: #1608393
2016-08-03 17:13:03 +08:00
Anton Arefiev 30ae1e72f1 Move unit tests to "unit" directory
This refoctor is needed for tempest test work as tempest tests
will placed in test dir. So move unit tests to separate directory
"unit" under test.

Change-Id: Ic99df6111ef30947148a9e38b9435a54f3d37064
2016-04-05 11:15:29 +03:00