From 300e9eee9dbe874538a224eca3fac215554003fd Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 8 Apr 2019 12:05:22 +0200 Subject: [PATCH 1/6] render_config_context action should live in fixtures pack since it's not used directly for end to end and st2-self-check tests. --- packs/{tests/actions => fixtures}/render_config_context.py | 0 packs/{tests/actions => fixtures}/render_config_context.yaml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename packs/{tests/actions => fixtures}/render_config_context.py (100%) rename packs/{tests/actions => fixtures}/render_config_context.yaml (100%) diff --git a/packs/tests/actions/render_config_context.py b/packs/fixtures/render_config_context.py similarity index 100% rename from packs/tests/actions/render_config_context.py rename to packs/fixtures/render_config_context.py diff --git a/packs/tests/actions/render_config_context.yaml b/packs/fixtures/render_config_context.yaml similarity index 100% rename from packs/tests/actions/render_config_context.yaml rename to packs/fixtures/render_config_context.yaml From 62be3ccea15bc2e312d812c3f20d05c08e6a2937 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 8 Apr 2019 12:11:22 +0200 Subject: [PATCH 2/6] Add new end to end test for running render_config_context action. --- .../chains/test_render_config_context.yaml | 27 +++++++++++++++++++ .../actions/test_render_config_context.yaml | 20 ++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 packs/tests/actions/chains/test_render_config_context.yaml create mode 100644 packs/tests/actions/test_render_config_context.yaml diff --git a/packs/tests/actions/chains/test_render_config_context.yaml b/packs/tests/actions/chains/test_render_config_context.yaml new file mode 100644 index 0000000..97f7be7 --- /dev/null +++ b/packs/tests/actions/chains/test_render_config_context.yaml @@ -0,0 +1,27 @@ +--- + +# Workflow for testing config context rendering + +chain: + +# Executing inquiry workflow via CLI instead of directly via ref so this workflow doesn't get paused +- name: "run_render_config_context_action" + ref: "fixtures.render_config_context" + params: + on-success: "assert_action_output" + on-failure: "fail" + +########### +# ASSERTS # +########### + +- name: "assert_action_output" + ref: "asserts.object_key_string_equals" + params: + object: "{{ run_render_config_context_action.result[0] }}" + key: context_value + value: Testing + +- name: "fail" + ref: core.local + cmd: exit 1 diff --git a/packs/tests/actions/test_render_config_context.yaml b/packs/tests/actions/test_render_config_context.yaml new file mode 100644 index 0000000..72dcb08 --- /dev/null +++ b/packs/tests/actions/test_render_config_context.yaml @@ -0,0 +1,20 @@ +--- +# Action definition metadata +name: "test_render_config_context" +description: "Workflow which tests render_config_context functionality" +runner_type: "action-chain" +enabled: true +entry_point: "chains/test_render_config_context.yaml" +parameters: + token: + type: "string" + description: "st2 auth token" + default: "" + protocol: + type: "string" + description: "http/https" + default: "http" + hostname: + type: "string" + description: "St2 host to run tests against" + default: "127.0.0.1" From 369fe67f7b6495d86cbb36dce4f3714307f7e86c Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 8 Apr 2019 12:14:02 +0200 Subject: [PATCH 3/6] Fix path. --- packs/fixtures/{ => actions}/render_config_context.py | 0 packs/fixtures/{ => actions}/render_config_context.yaml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename packs/fixtures/{ => actions}/render_config_context.py (100%) rename packs/fixtures/{ => actions}/render_config_context.yaml (100%) diff --git a/packs/fixtures/render_config_context.py b/packs/fixtures/actions/render_config_context.py similarity index 100% rename from packs/fixtures/render_config_context.py rename to packs/fixtures/actions/render_config_context.py diff --git a/packs/fixtures/render_config_context.yaml b/packs/fixtures/actions/render_config_context.yaml similarity index 100% rename from packs/fixtures/render_config_context.yaml rename to packs/fixtures/actions/render_config_context.yaml From be9ce469c40a7e85e2f506b764c60c973d47dec7 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 8 Apr 2019 12:17:04 +0200 Subject: [PATCH 4/6] Move schema to the correct pack. --- packs/fixtures/config.schema.yaml | 5 +++++ packs/tests/actions/chains/test_render_config_context.yaml | 4 ++-- packs/tests/config.schema.yaml | 6 ------ 3 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 packs/tests/config.schema.yaml diff --git a/packs/fixtures/config.schema.yaml b/packs/fixtures/config.schema.yaml index eaa2404..23ca88a 100644 --- a/packs/fixtures/config.schema.yaml +++ b/packs/fixtures/config.schema.yaml @@ -7,3 +7,8 @@ type: "integer" default: 19009 required: false + config_item_one: + description: "Item use to test config context." + type: "string" + required: true + default: "Testing" diff --git a/packs/tests/actions/chains/test_render_config_context.yaml b/packs/tests/actions/chains/test_render_config_context.yaml index 97f7be7..ed51abe 100644 --- a/packs/tests/actions/chains/test_render_config_context.yaml +++ b/packs/tests/actions/chains/test_render_config_context.yaml @@ -7,7 +7,6 @@ chain: # Executing inquiry workflow via CLI instead of directly via ref so this workflow doesn't get paused - name: "run_render_config_context_action" ref: "fixtures.render_config_context" - params: on-success: "assert_action_output" on-failure: "fail" @@ -24,4 +23,5 @@ chain: - name: "fail" ref: core.local - cmd: exit 1 + params: + cmd: exit 1 diff --git a/packs/tests/config.schema.yaml b/packs/tests/config.schema.yaml deleted file mode 100644 index 2e98ce6..0000000 --- a/packs/tests/config.schema.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -config_item_one: - description: "Item use to test config context." - type: "string" - required: true - default: "Testing" From 4ff031292c9b2102e33282d23d899e94280c41ac Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 8 Apr 2019 12:18:54 +0200 Subject: [PATCH 5/6] Fix typo. --- packs/tests/actions/chains/test_render_config_context.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packs/tests/actions/chains/test_render_config_context.yaml b/packs/tests/actions/chains/test_render_config_context.yaml index ed51abe..bf3e17d 100644 --- a/packs/tests/actions/chains/test_render_config_context.yaml +++ b/packs/tests/actions/chains/test_render_config_context.yaml @@ -17,7 +17,7 @@ chain: - name: "assert_action_output" ref: "asserts.object_key_string_equals" params: - object: "{{ run_render_config_context_action.result[0] }}" + object: "{{ run_render_config_context_action.result }}" key: context_value value: Testing From 1ab2af4be609faff45cf81f48be02123b46910ff Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 8 Apr 2019 12:26:39 +0200 Subject: [PATCH 6/6] Use assert.object_equals since object key equals is broken. --- packs/tests/actions/chains/test_render_config_context.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packs/tests/actions/chains/test_render_config_context.yaml b/packs/tests/actions/chains/test_render_config_context.yaml index bf3e17d..27d75db 100644 --- a/packs/tests/actions/chains/test_render_config_context.yaml +++ b/packs/tests/actions/chains/test_render_config_context.yaml @@ -15,11 +15,12 @@ chain: ########### - name: "assert_action_output" - ref: "asserts.object_key_string_equals" + ref: "asserts.object_equals" params: object: "{{ run_render_config_context_action.result }}" - key: context_value - value: Testing + expected: + context_value: Testing + on-failure: "fail" - name: "fail" ref: core.local