From 9ff7abe089e1a5ce0a9d7a94a77144de8d028719 Mon Sep 17 00:00:00 2001 From: Matt Casters Date: Tue, 14 Jan 2025 17:35:21 +0100 Subject: [PATCH] Improvements for issues #3454 and #4771 (integration tests) --- ...t.yaml => integration-tests-resolver.yaml} | 0 .../0001-vault-add-secrets.hpl} | 0 .../0001-vault-resolve-secrets.hpl} | 2 +- .../0002-pipeline-get-configurations.hpl | 191 ++++++++++ .../resolver/0002-pipeline-resolver-test.hpl | 342 ++++++++++++++++++ .../0001-golden-resolved-variables.csv | 0 .../0002-golden-pipeline-resolver.csv | 4 + .../resolver/dev-env-config.json | 3 + .../resolver/files/db1.properties | 7 + .../resolver/files/db2.properties | 7 + .../resolver/files/db3.properties | 7 + .../{vault => resolver}/hop-config.json | 0 .../main-0001-resolve-secrets.hwf | 12 +- .../resolver/main-0002-pipeline-resolver.hwf | 79 ++++ .../0001-golden-resolved-variables.json | 0 .../0002-golden-pipeline-resolver.json | 48 +++ .../pipeline-run-configuration/local.json | 0 .../0001-vault-resolve-secrets UNIT.json} | 4 +- .../0002-pipeline-resolver-test UNIT.json | 81 +++++ .../metadata/variable-resolver/conf.json | 13 + .../metadata/variable-resolver/pipeline.json | 13 + .../metadata/variable-resolver/vault.json | 0 .../workflow-run-configuration/local.json | 0 .../{vault => resolver}/project-config.json | 0 integration-tests/vault/dev-env-config.json | 19 - 25 files changed, 805 insertions(+), 27 deletions(-) rename docker/integration-tests/{integration-tests-vault.yaml => integration-tests-resolver.yaml} (100%) rename integration-tests/{vault/0001-add-secrets.hpl => resolver/0001-vault-add-secrets.hpl} (100%) rename integration-tests/{vault/0001-resolve-secrets.hpl => resolver/0001-vault-resolve-secrets.hpl} (98%) create mode 100644 integration-tests/resolver/0002-pipeline-get-configurations.hpl create mode 100644 integration-tests/resolver/0002-pipeline-resolver-test.hpl rename integration-tests/{vault => resolver}/datasets/0001-golden-resolved-variables.csv (100%) create mode 100644 integration-tests/resolver/datasets/0002-golden-pipeline-resolver.csv create mode 100644 integration-tests/resolver/dev-env-config.json create mode 100644 integration-tests/resolver/files/db1.properties create mode 100644 integration-tests/resolver/files/db2.properties create mode 100644 integration-tests/resolver/files/db3.properties rename integration-tests/{vault => resolver}/hop-config.json (100%) rename integration-tests/{vault => resolver}/main-0001-resolve-secrets.hwf (91%) create mode 100644 integration-tests/resolver/main-0002-pipeline-resolver.hwf rename integration-tests/{vault => resolver}/metadata/dataset/0001-golden-resolved-variables.json (100%) create mode 100644 integration-tests/resolver/metadata/dataset/0002-golden-pipeline-resolver.json rename integration-tests/{vault => resolver}/metadata/pipeline-run-configuration/local.json (100%) rename integration-tests/{vault/metadata/unit-test/0001-resolve-secrets UNIT.json => resolver/metadata/unit-test/0001-vault-resolve-secrets UNIT.json} (91%) create mode 100644 integration-tests/resolver/metadata/unit-test/0002-pipeline-resolver-test UNIT.json create mode 100644 integration-tests/resolver/metadata/variable-resolver/conf.json create mode 100644 integration-tests/resolver/metadata/variable-resolver/pipeline.json rename integration-tests/{vault => resolver}/metadata/variable-resolver/vault.json (100%) rename integration-tests/{vault => resolver}/metadata/workflow-run-configuration/local.json (100%) rename integration-tests/{vault => resolver}/project-config.json (100%) delete mode 100644 integration-tests/vault/dev-env-config.json diff --git a/docker/integration-tests/integration-tests-vault.yaml b/docker/integration-tests/integration-tests-resolver.yaml similarity index 100% rename from docker/integration-tests/integration-tests-vault.yaml rename to docker/integration-tests/integration-tests-resolver.yaml diff --git a/integration-tests/vault/0001-add-secrets.hpl b/integration-tests/resolver/0001-vault-add-secrets.hpl similarity index 100% rename from integration-tests/vault/0001-add-secrets.hpl rename to integration-tests/resolver/0001-vault-add-secrets.hpl diff --git a/integration-tests/vault/0001-resolve-secrets.hpl b/integration-tests/resolver/0001-vault-resolve-secrets.hpl similarity index 98% rename from integration-tests/vault/0001-resolve-secrets.hpl rename to integration-tests/resolver/0001-vault-resolve-secrets.hpl index 5e2b5e1f290..91e88784856 100644 --- a/integration-tests/vault/0001-resolve-secrets.hpl +++ b/integration-tests/resolver/0001-vault-resolve-secrets.hpl @@ -19,7 +19,7 @@ limitations under the License. --> - 0001-resolve-secrets + 0001-vault-resolve-secrets Y diff --git a/integration-tests/resolver/0002-pipeline-get-configurations.hpl b/integration-tests/resolver/0002-pipeline-get-configurations.hpl new file mode 100644 index 00000000000..3358e05c089 --- /dev/null +++ b/integration-tests/resolver/0002-pipeline-get-configurations.hpl @@ -0,0 +1,191 @@ + + + + + 0002-pipeline-get-configurations + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/01/14 17:20:35.075 + - + 2025/01/14 17:20:35.075 + + + + + + files/${TYPE}.properties + get values + Y + + + get values + OUTPUT + Y + + + + OUTPUT + Dummy + + Y + + 1 + + none + + + + + 432 + 80 + + + + files/${TYPE}.properties + PropertyInput + + Y + + 1 + + none + + + UTF-8 + + + key + -1 + Key + -1 + N + none + String + + + value + -1 + Value + -1 + N + none + String + + + + N + N + ${PROJECT_HOME}/files/${TYPE}.properties + + property + N + N + N + Y + 0 + N + N + N + + + 128 + 80 + + + + get values + Denormaliser + + Y + + 1 + + none + + + + + Value + hostname + - + -1 + hostname + -1 + String + + + Value + port + - + -1 + port + -1 + String + + + Value + db + - + -1 + db + -1 + String + + + Value + username + - + -1 + username + -1 + String + + + Value + password + - + -1 + password + -1 + String + + + + + Key + + + 288 + 80 + + + + + + diff --git a/integration-tests/resolver/0002-pipeline-resolver-test.hpl b/integration-tests/resolver/0002-pipeline-resolver-test.hpl new file mode 100644 index 00000000000..ca6309c6424 --- /dev/null +++ b/integration-tests/resolver/0002-pipeline-resolver-test.hpl @@ -0,0 +1,342 @@ + + + + + 0002-pipeline-resolver-test + Y + + + + Normal + + + N + 1000 + 100 + - + 2025/01/14 17:22:13.379 + - + 2025/01/14 17:22:13.379 + + + + + + get db1 configuration + db1 + Y + + + get db2 configuration + db2 + Y + + + get db3 configuration + db3 + Y + + + db1 + Union + Y + + + db2 + Union + Y + + + db3 + Union + Y + + + Union + Validate + Y + + + + Validate + Dummy + + Y + + 1 + + none + + + + + 544 + 128 + + + + Union + Dummy + + Y + + 1 + + none + + + + + 432 + 128 + + + + db1 + Dummy + + Y + + 1 + + none + + + + + 304 + 64 + + + + db2 + Dummy + + Y + + 1 + + none + + + + + 304 + 128 + + + + db3 + Dummy + + Y + + 1 + + none + + + + + 304 + 192 + + + + get db1 configuration + GetVariable + + Y + + 1 + + none + + + + + -1 + hostname + -1 + none + String + #{conf:db1:hostname} + + + -1 + port + -1 + none + String + #{conf:db1:port} + + + -1 + db + -1 + none + String + #{conf:db1:db} + + + -1 + username + -1 + none + String + #{conf:db1:username} + + + -1 + password + -1 + none + String + #{conf:db1:port} + + + + + 144 + 64 + + + + get db2 configuration + GetVariable + + Y + + 1 + + none + + + + + -1 + hostname + -1 + none + String + #{conf:db2:hostname} + + + -1 + port + -1 + none + String + #{conf:db2:port} + + + -1 + db + -1 + none + String + #{conf:db2:db} + + + -1 + username + -1 + none + String + #{conf:db2:username} + + + -1 + password + -1 + none + String + #{conf:db2:port} + + + + + 144 + 128 + + + + get db3 configuration + GetVariable + + Y + + 1 + + none + + + + + -1 + hostname + -1 + none + String + #{conf:db3:hostname} + + + -1 + port + -1 + none + String + #{conf:db3:port} + + + -1 + db + -1 + none + String + #{conf:db3:db} + + + -1 + username + -1 + none + String + #{conf:db3:username} + + + -1 + password + -1 + none + String + #{conf:db3:port} + + + + + 144 + 192 + + + + + + diff --git a/integration-tests/vault/datasets/0001-golden-resolved-variables.csv b/integration-tests/resolver/datasets/0001-golden-resolved-variables.csv similarity index 100% rename from integration-tests/vault/datasets/0001-golden-resolved-variables.csv rename to integration-tests/resolver/datasets/0001-golden-resolved-variables.csv diff --git a/integration-tests/resolver/datasets/0002-golden-pipeline-resolver.csv b/integration-tests/resolver/datasets/0002-golden-pipeline-resolver.csv new file mode 100644 index 00000000000..2e62e22f338 --- /dev/null +++ b/integration-tests/resolver/datasets/0002-golden-pipeline-resolver.csv @@ -0,0 +1,4 @@ +hostname,port,db,username,password +hostname1,port1,db1,user1,port1 +hostname2,port2,db2,user2,port2 +hostname3,port3,db3,user3,port3 diff --git a/integration-tests/resolver/dev-env-config.json b/integration-tests/resolver/dev-env-config.json new file mode 100644 index 00000000000..1a9e9503b0b --- /dev/null +++ b/integration-tests/resolver/dev-env-config.json @@ -0,0 +1,3 @@ +{ + "variables" : [] +} \ No newline at end of file diff --git a/integration-tests/resolver/files/db1.properties b/integration-tests/resolver/files/db1.properties new file mode 100644 index 00000000000..91fbf75db5a --- /dev/null +++ b/integration-tests/resolver/files/db1.properties @@ -0,0 +1,7 @@ + +username=user1 +password=pwd1 +hostname=hostname1 +port=port1 +db=db1 + diff --git a/integration-tests/resolver/files/db2.properties b/integration-tests/resolver/files/db2.properties new file mode 100644 index 00000000000..e2bc4b9b335 --- /dev/null +++ b/integration-tests/resolver/files/db2.properties @@ -0,0 +1,7 @@ + +username=user2 +password=pwd2 +hostname=hostname2 +port=port2 +db=db2 + diff --git a/integration-tests/resolver/files/db3.properties b/integration-tests/resolver/files/db3.properties new file mode 100644 index 00000000000..5d0364f73f8 --- /dev/null +++ b/integration-tests/resolver/files/db3.properties @@ -0,0 +1,7 @@ + +username=user3 +password=pwd3 +hostname=hostname3 +port=port3 +db=db3 + diff --git a/integration-tests/vault/hop-config.json b/integration-tests/resolver/hop-config.json similarity index 100% rename from integration-tests/vault/hop-config.json rename to integration-tests/resolver/hop-config.json diff --git a/integration-tests/vault/main-0001-resolve-secrets.hwf b/integration-tests/resolver/main-0001-resolve-secrets.hwf similarity index 91% rename from integration-tests/vault/main-0001-resolve-secrets.hwf rename to integration-tests/resolver/main-0001-resolve-secrets.hwf index 898f1347d7f..ed5f53cb6ab 100644 --- a/integration-tests/vault/main-0001-resolve-secrets.hwf +++ b/integration-tests/resolver/main-0001-resolve-secrets.hwf @@ -49,7 +49,7 @@ limitations under the License. - 0001-add-secrets + 0001-vault-add-secrets.hpl PIPELINE @@ -59,7 +59,9 @@ limitations under the License. N N N - ${PROJECT_HOME}/0001-add-secrets.hpl + ${PROJECT_HOME}/0001-vault-add-secrets.hpl + + Basic Y @@ -81,7 +83,7 @@ limitations under the License. - 0001-resolve-secrets UNIT + 0001-vault-resolve-secrets UNIT N @@ -93,13 +95,13 @@ limitations under the License. Start - 0001-add-secrets + 0001-vault-add-secrets.hpl Y Y Y - 0001-add-secrets + 0001-vault-add-secrets.hpl Run Pipeline Unit Tests Y Y diff --git a/integration-tests/resolver/main-0002-pipeline-resolver.hwf b/integration-tests/resolver/main-0002-pipeline-resolver.hwf new file mode 100644 index 00000000000..2d18bfb8303 --- /dev/null +++ b/integration-tests/resolver/main-0002-pipeline-resolver.hwf @@ -0,0 +1,79 @@ + + + + main-0002-pipeline-resolver + Y + + + + - + 2025/01/14 17:21:30.278 + - + 2025/01/14 17:21:30.278 + + + + + Start + + SPECIAL + + 1 + 12 + 60 + 0 + 0 + N + 0 + 1 + N + 96 + 64 + + + + Run Pipeline Unit Tests + + RunPipelineTests + + + + 0002-pipeline-resolver-test UNIT + + + N + 256 + 64 + + + + + + Start + Run Pipeline Unit Tests + Y + Y + Y + + + + + + diff --git a/integration-tests/vault/metadata/dataset/0001-golden-resolved-variables.json b/integration-tests/resolver/metadata/dataset/0001-golden-resolved-variables.json similarity index 100% rename from integration-tests/vault/metadata/dataset/0001-golden-resolved-variables.json rename to integration-tests/resolver/metadata/dataset/0001-golden-resolved-variables.json diff --git a/integration-tests/resolver/metadata/dataset/0002-golden-pipeline-resolver.json b/integration-tests/resolver/metadata/dataset/0002-golden-pipeline-resolver.json new file mode 100644 index 00000000000..c864a438938 --- /dev/null +++ b/integration-tests/resolver/metadata/dataset/0002-golden-pipeline-resolver.json @@ -0,0 +1,48 @@ +{ + "base_filename": "0002-golden-pipeline-resolver.csv", + "name": "0002-golden-pipeline-resolver", + "description": "", + "dataset_fields": [ + { + "field_comment": "", + "field_length": -1, + "field_type": 2, + "field_precision": -1, + "field_name": "hostname", + "field_format": "" + }, + { + "field_comment": "", + "field_length": -1, + "field_type": 2, + "field_precision": -1, + "field_name": "port", + "field_format": "" + }, + { + "field_comment": "", + "field_length": -1, + "field_type": 2, + "field_precision": -1, + "field_name": "db", + "field_format": "" + }, + { + "field_comment": "", + "field_length": -1, + "field_type": 2, + "field_precision": -1, + "field_name": "username", + "field_format": "" + }, + { + "field_comment": "", + "field_length": -1, + "field_type": 2, + "field_precision": -1, + "field_name": "password", + "field_format": "" + } + ], + "folder_name": "" +} \ No newline at end of file diff --git a/integration-tests/vault/metadata/pipeline-run-configuration/local.json b/integration-tests/resolver/metadata/pipeline-run-configuration/local.json similarity index 100% rename from integration-tests/vault/metadata/pipeline-run-configuration/local.json rename to integration-tests/resolver/metadata/pipeline-run-configuration/local.json diff --git a/integration-tests/vault/metadata/unit-test/0001-resolve-secrets UNIT.json b/integration-tests/resolver/metadata/unit-test/0001-vault-resolve-secrets UNIT.json similarity index 91% rename from integration-tests/vault/metadata/unit-test/0001-resolve-secrets UNIT.json rename to integration-tests/resolver/metadata/unit-test/0001-vault-resolve-secrets UNIT.json index efd87aa6368..ef349db4543 100644 --- a/integration-tests/vault/metadata/unit-test/0001-resolve-secrets UNIT.json +++ b/integration-tests/resolver/metadata/unit-test/0001-vault-resolve-secrets UNIT.json @@ -47,7 +47,7 @@ } ], "input_data_sets": [], - "name": "0001-resolve-secrets UNIT", + "name": "0001-vault-resolve-secrets UNIT", "trans_test_tweaks": [], - "pipeline_filename": "./0001-resolve-secrets.hpl" + "pipeline_filename": "./0001-vault-resolve-secrets.hpl" } \ No newline at end of file diff --git a/integration-tests/resolver/metadata/unit-test/0002-pipeline-resolver-test UNIT.json b/integration-tests/resolver/metadata/unit-test/0002-pipeline-resolver-test UNIT.json new file mode 100644 index 00000000000..3996790f32f --- /dev/null +++ b/integration-tests/resolver/metadata/unit-test/0002-pipeline-resolver-test UNIT.json @@ -0,0 +1,81 @@ +{ + "database_replacements": [], + "autoOpening": true, + "description": "", + "persist_filename": "", + "test_type": "UNIT_TEST", + "variableValues": [], + "basePath": "", + "golden_data_sets": [ + { + "field_mappings": [ + { + "transform_field": "hostname", + "data_set_field": "hostname" + }, + { + "transform_field": "port", + "data_set_field": "port" + }, + { + "transform_field": "db", + "data_set_field": "db" + }, + { + "transform_field": "username", + "data_set_field": "username" + }, + { + "transform_field": "password", + "data_set_field": "password" + } + ], + "field_order": [ + "hostname", + "port", + "db", + "username", + "password" + ], + "data_set_name": "0002-golden-pipeline-resolver", + "transform_name": "Output" + }, + { + "field_mappings": [ + { + "transform_field": "hostname", + "data_set_field": "hostname" + }, + { + "transform_field": "port", + "data_set_field": "port" + }, + { + "transform_field": "db", + "data_set_field": "db" + }, + { + "transform_field": "username", + "data_set_field": "username" + }, + { + "transform_field": "password", + "data_set_field": "password" + } + ], + "field_order": [ + "hostname", + "port", + "db", + "username", + "password" + ], + "data_set_name": "0002-golden-pipeline-resolver", + "transform_name": "Validate" + } + ], + "input_data_sets": [], + "name": "0002-pipeline-resolver-test UNIT", + "trans_test_tweaks": [], + "pipeline_filename": "./0002-pipeline-resolver-test.hpl" +} \ No newline at end of file diff --git a/integration-tests/resolver/metadata/variable-resolver/conf.json b/integration-tests/resolver/metadata/variable-resolver/conf.json new file mode 100644 index 00000000000..885e2ddcf1f --- /dev/null +++ b/integration-tests/resolver/metadata/variable-resolver/conf.json @@ -0,0 +1,13 @@ +{ + "virtualPath": "", + "name": "conf", + "description": "Uses a pipeline to read configuration files using variable expressions", + "variable-resolver": { + "Variable-Resolver-Pipeline": { + "outputTransformName": "OUTPUT", + "filename": "${PROJECT_HOME}/0002-pipeline-get-configurations.hpl", + "expressionVariableName": "TYPE", + "runConfigurationName": "local" + } + } +} \ No newline at end of file diff --git a/integration-tests/resolver/metadata/variable-resolver/pipeline.json b/integration-tests/resolver/metadata/variable-resolver/pipeline.json new file mode 100644 index 00000000000..ac2db410d5b --- /dev/null +++ b/integration-tests/resolver/metadata/variable-resolver/pipeline.json @@ -0,0 +1,13 @@ +{ + "virtualPath": "", + "name": "pipeline", + "description": "", + "variable-resolver": { + "Variable-Resolver-Pipeline": { + "outputTransformName": "OUTPUT", + "filename": "${PROJECT_HOME}/0002-pipeline-get-configurations.hpl", + "expressionVariableName": "TYPE", + "runConfigurationName": "local" + } + } +} \ No newline at end of file diff --git a/integration-tests/vault/metadata/variable-resolver/vault.json b/integration-tests/resolver/metadata/variable-resolver/vault.json similarity index 100% rename from integration-tests/vault/metadata/variable-resolver/vault.json rename to integration-tests/resolver/metadata/variable-resolver/vault.json diff --git a/integration-tests/vault/metadata/workflow-run-configuration/local.json b/integration-tests/resolver/metadata/workflow-run-configuration/local.json similarity index 100% rename from integration-tests/vault/metadata/workflow-run-configuration/local.json rename to integration-tests/resolver/metadata/workflow-run-configuration/local.json diff --git a/integration-tests/vault/project-config.json b/integration-tests/resolver/project-config.json similarity index 100% rename from integration-tests/vault/project-config.json rename to integration-tests/resolver/project-config.json diff --git a/integration-tests/vault/dev-env-config.json b/integration-tests/vault/dev-env-config.json deleted file mode 100644 index 3f420732ace..00000000000 --- a/integration-tests/vault/dev-env-config.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "variables" : [ { - "name" : "NEO_HOSTNAME", - "value" : "neo4j", - "description" : "The neo4j hostname" - }, { - "name" : "NEO_PORT", - "value" : "7687", - "description" : "The data port " - }, { - "name" : "NEO_USERNAME", - "value" : "neo4j", - "description" : "Username: see the docker compose yml file" - }, { - "name" : "NEO_PASSWORD", - "value" : "abcdefgh", - "description" : "Password: see the docker compose yml file" - } ] -} \ No newline at end of file