Commit Graph

40 Commits

Author SHA1 Message Date
hparekh 568bbf5384 Removed mistral/tests/functional
All the changes has been merged to mistral_tempest_tests.
Also scrits has been changed.

Change-Id: I6c514a3c75f1b6e3b94b0e9b0e542697b68d9a02
Partially-Implements: blueprint mistral-tempest-plugin
2016-01-29 11:04:03 +09:00
Lingxian Kong 9f81a67a78 Support UUID when deleting a workflow definition
NOTE: A tenant can not delete workflows of other tenants.

Partially implements: blueprint use-workflow-id-in-rest-api
Change-Id: Ie3c1304a0ffe5cee49165ad19a976956e24c1ed7
2015-12-18 13:34:37 +08:00
hparekh f3d3e25235 Get "cron trigger" list using model query.
If cron-trigger is created in different tenant
than workflow's tenant, associated cron-trigger
can not be got. So "model_query" has been used
instead of "secure_query".

Change-Id: Ief78f2cad76e6ca16893bff80c5e75c9015e9c74
Closes-bug: #1522286
2015-12-14 16:41:04 +09:00
Moshe Elisha 976667c0a2 Fix concurrency issues by using READ_COMMITTED
The state of a workflow execution was not updated even when all task
executions were completed if some tasks finished at the same time as
other tasks.
Because we were using our connections with transaction isolation
level = REPEATABLE_READ - Each process was using a snapshot of the DB
created at the first read statement in that transaction.
When a task finished and evaluated the state of all the other tasks
it did not see the up-to-date state of those tasks - and so, because
not all tasks were completed - the task did not change the workflow
execution state.

Similar behavior happened with multiple action executions under same
task. On completion, each action execution checked the status of the
other action executions and did not see the up-to-date state of these
action execution - causing task execution to stay in RUNNING state.

Change-Id: I12f66134d92b8ed39df9d6128d7de5ee49aa8623
Closes-Bug: #1518012
Closes-Bug: #1513456
2015-12-09 08:01:38 +00:00
Nikolay Mahotkin e0c00aa516 Fixing wf execution creation at initial stage
* Wf execution is not created when first
   task(s) failed.
 * Fixed some unit-tests.

Closes-Bug: #1506470

Change-Id: Id34b11efe15fcff0a9360e2966d1a85c29325c62
2015-11-09 11:33:45 +03:00
hardik 2e4054513a Check for trigger before delete wf.
When wf which has trigger is deleted
DBRefrenceException was thrown.

Change-Id: Icb8d73fafeede057ac3e698c91ec0bd7e63c2ba0
Closes-bug: #1383170
2015-09-22 07:52:41 +05:30
Lingxian Kong 7a12e30d07 Refactor get_task_spec using mechanism of polymorphic DSL entities
* Changing the way of getting task spec using polymorphic mechanism,
which is the motivation of this patch.

* Moving the type injection in TaskSpec to WorkflowSpec, the 'type'
param is already there when TaskSpec initializing, and we could also
continue to use that for polymorphic mechanism of TaskSpec, and the
subclasses iteration mechanism can also be removed as well.

* Improving the schema validation for TaskSpec, replace the code logic
of prohibition of co-existance between action and workflow in task spec
with jsonschema restriction.

Change-Id: Ia88ce390298d54afc1ee72ebfb67de9056d9f444
2015-09-15 15:29:05 +08:00
Lingxian Kong f2eaea5a12 Support action_execution deletion
With this patch, users can perform operation as following:
DELETE http://127.0.0.1:8989/v2/action_executions/<action_execution_id>

NOTE:
* Added a new config item 'allow_action_execution_deletion', with default
  value 'False'.
* The 'allow_action_execution_deletion' item is set to 'True' for
  functional testing.
* Only ad-hoc action-execution can be deleted.
* Only completed action execution can be deleted.

Implements: blueprint mistral-action-execution-deletion
Closes-Bug: #1488157
Change-Id: I3729636911a42c273c5a7b2d7fbdaae0da398e31
2015-09-07 13:18:41 +00:00
Jenkins 11bbd8501e Merge "Add fields filter for workflow query" 2015-09-02 08:41:26 +00:00
Nikolay Mahotkin 11adbf4a0c Fixing occasional fail of test_create_action_execution
* Fixed functional test 'test_create_action_execution'
 * Sometimes action execution is still not completed and
   response contains no output. Changed that mechanism to
   wait for completeness.

Change-Id: I6c27dd87e754e9cffc809922ad963ccebdcf7930
2015-09-01 13:11:22 +03:00
Renat Akhmerov a4175da422 Refactor action execution controller and tests
* Fixing custom WSME type for json fields. Making it able to convert
  values in both direction (to base type and from base type).
* Changed type of ActionExecution resource fields 'input' and 'output'
  to new custom json type.
* Fixed action execution controller where necessary.
* Adjusted and refactored action execution controller tests.

Change-Id: I28d0f3204518a2688cb72acefd910d9d99ada66d
2015-08-27 13:03:50 +00:00
Lingxian Kong 32e36450db Add fields filter for workflow query
With this patch, users could retrieve workflows only with fields they care
about.

NOTE: 'id' must be included in fields if it's provided, since 'id' will be
used when constructing 'next' link.

This feature is just like we specicy '-c' argument in CLI, but it's
implemented in server side(or more precisely, in db layer).

Partially-Implements: blueprint query-result-column-filtering
Change-Id: If034e7ee96aaecf2d5cebefdc85eaa7b3f6f7d8c
2015-08-27 20:38:20 +08:00
Lingxian Kong 025cb8cf43 Fix failure in execution pagination functioinal tests
* The returned workflows order of creation is not the same with their
  order in definition file.
* Add another workflow definition in wf_v2.yaml using by functional
  testing

Change-Id: I81c78580f7365363b5f45b98328f94ae90c65ba1
2015-08-27 17:55:23 +08:00
Jenkins 5b86095951 Merge "Add pagination support for executions query API" 2015-08-25 11:22:15 +00:00
Jenkins 4b25ae73c3 Merge "Add schema for additional properties of BaseListSpec" 2015-08-25 11:19:51 +00:00
kong e6b7aac341 Add schema for additional properties of BaseListSpec
Exception should be raised for creation of workflow such as:

---
version: '2.0'
name: which_should_not_appear
wf:
  type: direct
  tasks:
    task1: std.echo output='hello, world.'

For jsonschema, If additionalProperties is an object, that object is a
schema that will be used to validate any additional properties not listed
in properties.

Change-Id: I11a0e514f525a1ce278bdbf69d001a6249ef2183
Closes-Bug: #1442128
2015-08-25 17:13:23 +08:00
LingxianKong f5a03c6bbb Add pagination support for executions query API
Add query params for action list REST API:

* limit: return a maximun number of items at a time, default is None, the
  query result will include all the resource items, which is backward
  compatible.

* marker: the ID of the last item in the previous list.

* sort_keys: columns to sort results by. Default: created_at, which is
  backward compatible.

* sort_dirs: directions to sort corresponding to sort_keys, "asc" or
  "desc" can be choosed. Default: desc. The length of sort_dirs can
  be equal or less than that of sort_keys.

Change-Id: I2fcca2a5589936d24aa52245a686115598fbd858
Partially-Implements: blueprint mistral-pagination-support
2015-08-25 01:03:52 +08:00
Lingxian Kong 5bd01b7bfb Purge executions created during functional testing
Change-Id: Ibcfbe23d2608d43a21e7a5b77002071672325fa9
Partial-Bug: #1488157
2015-08-25 00:14:34 +08:00
kong 9f95f3775f Add pagination support for actions query API
Add query params for action list REST API:

* limit: return a maximun number of items at a time, default is None, the
  query result will include all the resource items, which is backward
  compatible.

* marker: the ID of the last item in the previous list.

* sort_keys: columns to sort results by. Default: name, which is backward
  compatible.

* sort_dirs: directions to sort corresponding to sort_keys, "asc" or
  "desc" can be choosed. Default: asc. The length of sort_dirs can
  be equal or less than that of sort_keys.

Change-Id: Ied5b48244cc94a3039ebafce40f3c2ae25f9a48e
Partially-Implements: blueprint mistral-pagination-support
2015-08-20 13:26:57 +08:00
LingxianKong 6d707f2306 Add functional tests for workflow query
Change-Id: I5ffff57d0d4c4fdbd8b62b4ee652074060a137bb
Partially-Implements: blueprint mistral-query-enhancement
2015-08-19 13:36:33 +00:00
Nikolay Mahotkin d562be729b Fixing error result in run-action command
Closes-Bug: #1477116

Change-Id: I994b2d54470cd8d78b20dd3cfe81be293872bcfd
2015-07-28 13:15:28 +03:00
Nikolay Mahotkin 1db5ff4406 Fixing std.http action
* The problem comes from JSON serializing. Cookies and
   datetime is not JSON serializable, so we need to
   preprocess them manually.

Closes-Bug: #1477048

Change-Id: I2dbd1463f1b3549f661c0dba46ab6f949c4fffb4
2015-07-28 13:14:54 +03:00
Nikolay Mahotkin 786b7adb46 Implementing action_execution POST API
* Mistral API now enables POST on /action_executions
 * 2 ways of work - synchronous and asynchronous:
     returns result immediately or saving action_execution
     to the DB. it is controlled by 'save_result' option in
     'params' key of the request.
 * fixed returning error back in executior

TODO (next commit):
  - Implementing 'run-action' cmd in python-mistralclient

Implements blueprint mistral-run-individual-action

Change-Id: I365ec8b92e9bed72bb05c618323f18f5ca7b82e5
2015-06-25 09:50:15 +03:00
kong 834f69839a Fix execution update description error
Fix the wrong param of db update execution api, add some tests accordingly.

Change-Id: I7c389e781f9982703115d82d0336ddb0df6b2b99
Closes-Bug: #1467114
2015-06-22 14:22:19 +00:00
Nikolay Mahotkin 3b16cd8dd2 Fixing execution-update API
* Fixed handling wrong using execution-update
 * Fixed session hanging in case incorrect using execution update API:
     in case of exception neither commit_tx nor rollback_tx has not
     been invoked -> session acquired semaphore but didn't release it.
   Note: it is related only to sqlite (used in unit tests).

Closes-Bug: #1449557

Change-Id: Ic8874b2d498167cac1a88f6d138e8ac0e1d9a67f
2015-06-04 07:46:12 +03:00
Nikolay Mahotkin aa187d14ef Fixing result ordering in 'with-items'
Closes-Bug: #1442102

Change-Id: Iacc948c2d797c33b90523e272e37d34820bab006
2015-04-16 11:21:22 +03:00
Renat Akhmerov 402e0888d4 Fixing exception type that workbook negative tests expect
Change-Id: Ic66019948873f1793230d380829008194a931fc4
2015-04-09 17:47:36 +06:00
Pierre-Arthur MATHIEU f2cb7524e4 Trigger remaining-executions and first-exec-date
Adds the support of two optionals parameters for the cron-trigger resource:
  -first_execution_date : supersedes to the first calculation of
"next_execution_time".
  -remaining_occurrences: number of occurrences after which the trigger should
be deleted.

The parameter "pattern" is now optional if first-execution-date only is used.

Implements: blueprint mistral-cron-triggers-start-and-repeat
Change-Id: I55bc28e98f89ffdfdce9cb3daa3848a17d85fd20
2015-03-19 11:06:50 +00:00
Renat Akhmerov bdefdc6a6f Refactoring task output: full redesign of DB models
* Created a Execution hierarcy mapped on a single table:
  - ActionExecution
  - WorkflowExecution
  - TaskExecution
* Created necessary associations within Execution hierarchy
* Created necessary methods for Execution objects on DB API
* Created Definition hierarchy mapped on separate tables:
  - Workbook
  - WorkflowDefinition
  - ActionDefinition
* Renamed attributes
  - 'wf_name' -> 'workflow_name'
  - 'wf_spec' -> 'spec'
* Fixed all unit tests

TODO:
* Complete renaming throughout the code
* Further refactoring of workflow engine

Change-Id: I0032bea573d9200025f9f7dd951e93cb6f1661bb
2015-03-03 16:50:55 +06:00
Dmitri Zimine 6a1352ac6a Expose stop_workflow in API
Client sometimes needs to stop the workflow. Most often, when there is
an obvious error and it makes no sense to wait for completion. Or
when execution got to zombie state by any reasons.

Provide an ability to force-stop the workflow, pass SUCCESS or
ERROR, and status message for client message or error info.

- [x] Add public method and tests to default_engine.
- [x] Expose stop_workflow in rpc.
- [x] Expose in API.
- [x] Add a functional test.

Change-Id: I1bee7d9d780c1b1d09bc146843c751802e68f8fc
2015-02-18 01:17:24 -08:00
Anastasia Kuznetsova 5c6f521780 Fix tempest gate, add tempest import to our script
Change-Id: I0c3094c724b0c72fe79fb38ce628c808620be03a
2015-02-12 17:37:14 +04:00
Anastasia Kuznetsova 15e92ff4a5 Fix imports due to changes in tempest
Change-Id: I4705912e25e2e7517b78cf98fd87c36ab8402bc2
2015-01-21 15:33:46 +04:00
Anastasia Kuznetsova fa0bbe0842 Fix mistralclient initialization
Change-Id: I2ea334cecbcd5992bb8e5dd944ed6c49c5aff3e4
2015-01-12 16:45:50 +04:00
Anastasia Kuznetsova 407eeb5551 Refactor API tests for v2
- Separated v1 and v2 api tests for workbooks and executions;
- Added more tests scenarios;
- Optimize methods realization for v2 tests.

Change-Id: Ic24383bc7e6c059088e98eeeeab28ae7bda2de6a
Closes-Bug: #1384564
2014-11-27 17:03:04 +04:00
Anastasia Kuznetsova 3672b7947f Add API integration tests for actions
Added positive and negative API tests for 'actions'
endpoint.

Change-Id: I6e5fdb83359371e53c28873b74a77138dd38b6fe
2014-10-29 11:43:14 +04:00
Anastasia Kuznetsova e00ad25ca6 Add functional API tests for cron-triggers
- Added API tests which check main api calls to cron-trigger endpoint
- Fixed tearDown method (there was a problem when item array
had a few elements, not all of them were deleted)

Partly implements: blueprint mistral-triggers-functional-tests

Change-Id: Ibba7cd03e6ccdf06c76ea4ea161542b954faee0f
2014-10-20 15:48:50 +04:00
Anastasia Kuznetsova 888fefc37e Update tearDown methods in API integration tests
After testing new script run_functional_tests one destructive issue
was discovered that after this script all executions were deleted.

This situation was fixed. Now in all create methods identifier of
created object saves in array and in tearDown methods tests delete
only objects which were saved in appropriate arrays.

Change-Id: I442aecd346c003cd38ce6977e4f69f9bfa32e894
2014-10-02 12:11:53 +04:00
Anastasia Kuznetsova 411812e5fd Fix API tests for v2 version
Change-Id: I2e7b70d15de95639d1536fc3e2709dbbfc31002c
2014-09-25 11:45:52 +04:00
Anastasia Kuznetsova 763b091565 Add param 'name' to the test definition
Change-Id: Idce966178ef835b493fce928dc6e6be516fc6552
2014-09-22 12:50:38 +04:00
Anastasia Kuznetsova b5724cae4a Add API integration tests for v2
- Added integration tests for API version 2
- Refactor base.py, separate methods for v1 and v2
- Created second endpoint /v2 in keystone in devstack installation

Change-Id: Ibe23971b2335242ed72b837bfc1f861d0a74e395
2014-09-18 13:19:05 +04:00