-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add on-cluster workflow test to CI (#887)
**Pull Request Checklist** - [x] Fixes #652 - [x] Tests added - [x] Documentation/examples added - [x] [Good commit messages](https://cbea.ms/git-commit/) and/or PR title **Description of PR** Introduce local Argo cluster workflow tests to CI, and `make` targets to set up a local cluster for testing (this worked very well on GitHub codespaces, where I could even get a web UI to the cluster). Added a single test to confirm the workflow runs via `create` and reaches the `succeeded` `status.phase`. We can think about creating a more flexible/extensible framework for adding `on_cluster` tests - * I'd like to use a subset of our examples * But we want to assert on more than the `status.phase`, e.g. output values, running order, skipped nodes etc, which would require bespoke tests for each * It would also be good to have a wrapper for fetching these values, e.g. getting a node requires iterating through the `status.nodes` dictionary, which is keyed by hashes, so you have to check `displayName` from the values. --------- Signed-off-by: Elliot Gunton <[email protected]>
- Loading branch information
1 parent
19fa389
commit a8edc84
Showing
5 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
docs/examples/workflows-examples.md | ||
../docs/examples/workflows-examples.md |
This file contains 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 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 @@ | ||
import pytest | ||
|
||
from hera.workflows import Steps, Workflow, WorkflowsService, script | ||
|
||
|
||
@script() | ||
def echo(message: str): | ||
print(message) | ||
|
||
|
||
def get_workflow() -> Workflow: | ||
with Workflow( | ||
generate_name="hello-world-", | ||
entrypoint="steps", | ||
namespace="argo", | ||
workflows_service=WorkflowsService( | ||
host="https://localhost:2746", | ||
namespace="argo", | ||
verify_ssl=False, | ||
), | ||
) as w: | ||
with Steps(name="steps"): | ||
echo(arguments={"message": "Hello world!"}) | ||
return w | ||
|
||
|
||
@pytest.mark.on_cluster | ||
def test_create_hello_world(): | ||
model_workflow = get_workflow().create(wait=True) | ||
assert model_workflow.status and model_workflow.status.phase == "Succeeded" |