-
Notifications
You must be signed in to change notification settings - Fork 79
Workflow API support #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Workflow API support #613
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| class WorkflowAPI(object): | ||
| produces = () | ||
| consumes = () | ||
| apis = () | ||
|
|
||
| def __init__(self): | ||
| pass | ||
|
|
||
| @classmethod | ||
| def serialize(cls): | ||
| return { | ||
| 'name': cls.__name__, | ||
| 'module': cls.__module__, | ||
| 'consumes': [model.__name__ for model in cls.consumes], | ||
| 'produces': [model.__name__ for model in cls.produces], | ||
| 'apis': [api.__name__ for api in cls.apis] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"name": "workflow-api-tests", "id": "e8bfeffe-9131-4792-bcc3-760628e0fc4b"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
|
|
||
| [repositories] | ||
| repo_path=${repository:root_dir} | ||
|
|
||
| [database] | ||
| path=${repository:state_dir}/leapp.db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| [loggers] | ||
| keys=urllib3,root | ||
|
|
||
| [formatters] | ||
| keys=leapp | ||
|
|
||
| [handlers] | ||
| keys=leapp_audit,stream | ||
|
|
||
| [formatter_leapp] | ||
| format=%(asctime)s.%(msecs)-3d %(levelname)-8s PID: %(process)d %(name)s: %(message)s | ||
| datefmt=%Y-%m-%d %H:%M:%S | ||
| class=logging.Formatter | ||
|
|
||
| [logger_urllib3] | ||
| level=WARN | ||
| qualname=urllib3 | ||
| handlers=stream | ||
|
|
||
| [logger_root] | ||
| level=DEBUG | ||
| handlers=leapp_audit,stream | ||
|
|
||
| [handler_leapp_audit] | ||
| class=leapp.logger.LeappAuditHandler | ||
| formatter=leapp | ||
| args=() | ||
|
|
||
| [handler_stream] | ||
| class=StreamHandler | ||
| level=ERROR | ||
| formatter=leapp | ||
| args=(sys.stderr,) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from leapp.actors import Actor | ||
| from leapp.exceptions import StopActorExecutionError | ||
| from leapp.tags import FirstPhaseTag, WorkflowApiTestWorkflowTag | ||
| from leapp.workflows.api.v1 import TestAPI | ||
|
|
||
|
|
||
| class ApiV1Test(Actor): | ||
| """ | ||
| This actor will check that the testing API ApiV3Test is behaving as expected. | ||
| """ | ||
|
|
||
| name = 'api_v1_test' | ||
| consumes = () | ||
| produces = () | ||
| apis = (TestAPI,) | ||
| tags = (FirstPhaseTag, WorkflowApiTestWorkflowTag) | ||
|
|
||
| def process(self): | ||
| api = TestAPI() | ||
| # Expected output is always the order a, b, c | ||
| # The parameter order here also is however a, b, c | ||
| if api.order_change(1, 2, 3) != (1, 2, 3): | ||
vinzenz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| raise StopActorExecutionError("order change API failure") | ||
|
|
||
| # Expected is that the input is prefixed with 'survivor.v3.' | ||
| if api.survivor("APIV1Test") != "survivor.v3.APIV1Test": | ||
| raise StopActorExecutionError("v1 survivor test failure") | ||
|
|
||
| # Ensure removed is available and works (Doesn't really do anything just ensures not to have an exception) | ||
| api.removed("ApiV1Test calls removed method") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| from leapp.actors import Actor | ||
| from leapp.tags import FirstPhaseTag, WorkflowApiTestWorkflowTag | ||
| from leapp.workflows.api.v2 import TestAPI | ||
|
|
||
|
|
||
| class ApiV2Test(Actor): | ||
| """ | ||
| This actor will check that the testing API ApiV3Test is behaving as expected. | ||
| """ | ||
|
|
||
| name = 'api_v2_test' | ||
| consumes = () | ||
| produces = () | ||
| apis = (TestAPI,) | ||
| tags = (FirstPhaseTag, WorkflowApiTestWorkflowTag) | ||
|
|
||
| def process(self): | ||
| api = TestAPI() | ||
| # Expected output is always the order a, b, c | ||
| # The parameter order here is however c, b, a | ||
| if api.order_change(3, 2, 1) != (1, 2, 3): | ||
| raise StopActorExecutionError("order change API failure") | ||
|
|
||
| # Expected is that the input is prefixed with 'survivor.v3.' | ||
| if api.survivor("APIV2Test") != "survivor.v3.APIV2Test": | ||
| raise StopActorExecutionError("v2 survivor test failure") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| from leapp.actors import Actor | ||
| from leapp.exceptions import StopActorExecutionError | ||
| from leapp.tags import FirstPhaseTag, WorkflowApiTestWorkflowTag | ||
| from leapp.workflows.api.v3 import TestAPI | ||
|
|
||
|
|
||
| class ApiV3Test(Actor): | ||
| """ | ||
| This actor will check that the testing API ApiV3Test is behaving as expected. | ||
| """ | ||
|
|
||
| name = 'api_v3_test' | ||
| consumes = () | ||
| produces = () | ||
| apis = (TestAPI,) | ||
| tags = (FirstPhaseTag, WorkflowApiTestWorkflowTag) | ||
|
|
||
| def process(self): | ||
| api = TestAPI() | ||
| # Expected output is always the order a, b, c | ||
| # The parameter order here is however b, c, a | ||
| if api.order_change(2, 3, 1) != (1, 2, 3): | ||
| raise StopActorExecutionError("order change API failure") | ||
|
|
||
| # Expected is that the input is prefixed with 'survivor.v3.' | ||
| if api.survivor("APIV3Test") != "survivor.v3.APIV3Test": | ||
| raise StopActorExecutionError("v3 survivor test failure") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.