From 70b5963f6591a31313f7af771669558236775eaa Mon Sep 17 00:00:00 2001 From: Dustin Black Date: Wed, 20 Dec 2023 18:43:20 +0100 Subject: [PATCH] update integration tests --- docker-compose.yaml | 4 +-- tests/integration/fixtures/empty_data.yaml | 8 +++-- tests/integration/fixtures/nested_data.yaml | 36 +++++++++++++------ tests/integration/fixtures/simple_data.yaml | 21 ++++++++--- .../test_arcaflow_plugin_opensearch.py | 8 +++++ 5 files changed, 59 insertions(+), 18 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 7a25fc0..827a3ed 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -29,9 +29,9 @@ services: - ELASTICSEARCH_URL=http://elasticsearch.integration:9200 - ELASTICSEARCH_USERNAME=elastic - ELASTICSEARCH_PASSWORD=topsecret - command: "-f /configs/opensearch_example.yaml" + command: "-f /inputs/opensearch_example.yaml" volumes: - - ./configs:/configs:Z + - ./inputs:/inputs:Z depends_on: elasticsearch-integration: condition: service_healthy diff --git a/tests/integration/fixtures/empty_data.yaml b/tests/integration/fixtures/empty_data.yaml index ba298fa..1e1e79b 100644 --- a/tests/integration/fixtures/empty_data.yaml +++ b/tests/integration/fixtures/empty_data.yaml @@ -1,5 +1,9 @@ url: OPENSEARCH_URL username: OPENSEARCH_USERNAME password: OPENSEARCH_PASSWORD -index: empty-data -data: {} +default_index: empty-data +metadata: {} +bulk_upload_list: + - operation: + index: {} + data: {} diff --git a/tests/integration/fixtures/nested_data.yaml b/tests/integration/fixtures/nested_data.yaml index a8520ab..445760d 100644 --- a/tests/integration/fixtures/nested_data.yaml +++ b/tests/integration/fixtures/nested_data.yaml @@ -1,14 +1,30 @@ url: OPENSEARCH_URL username: OPENSEARCH_USERNAME password: OPENSEARCH_PASSWORD -index: nested-data -data: { - "keyNo3": "Mambo No 3", - "nestedKey": { - "deeper-nested-1": { - "deeper-nested-key": 1, - "another-key-deeply-nested": "here I am" - }, - "deeper-nested-2": "some value" - }, +default_index: nested-data +metadata: { + "mKeyNo1": "squirrel", + "mKeyNo2": { + "Translations": [ + - "Eichhörnchen" + - "ardilla" + - "écureuil" + - "scoiattolo" + ] + } } +bulk_upload_list: + - operation: + index: + _index: nested-data + _id: abc123def + data: { + "keyNo3": "Mambo No 3", + "nestedKey": { + "deeper-nested-1": { + "deeper-nested-key": 1, + "another-key-deeply-nested": "here I am" + }, + "deeper-nested-2": "some value" + }, + } diff --git a/tests/integration/fixtures/simple_data.yaml b/tests/integration/fixtures/simple_data.yaml index 2a290ef..b65803f 100644 --- a/tests/integration/fixtures/simple_data.yaml +++ b/tests/integration/fixtures/simple_data.yaml @@ -1,8 +1,21 @@ url: OPENSEARCH_URL username: OPENSEARCH_USERNAME password: OPENSEARCH_PASSWORD -index: simple-data -data: { - "keyNo1": "xXx", - "keyNo2": "Mambo No 5", +default_index: simple-data +metadata: { + "mKeyNo1": "squirrel", + "mKeyNo2": "Eichhörnchen", } +bulk_upload_list: + - operation: + index: {} + data: { + "keyNo1": "xXx", + "keyNo2": "Mambo No 5", + } + - operation: + create: {} + data: { + "keyNo1": "yYy", + "keyNo2": "Mambo No 6", + } diff --git a/tests/integration/test_arcaflow_plugin_opensearch.py b/tests/integration/test_arcaflow_plugin_opensearch.py index e8338ed..5050fd9 100644 --- a/tests/integration/test_arcaflow_plugin_opensearch.py +++ b/tests/integration/test_arcaflow_plugin_opensearch.py @@ -51,6 +51,8 @@ def test_simple_data(self) -> None: expectedData = { "keyNo1": "xXx", "keyNo2": "Mambo No 5", + "mKeyNo1": "squirrel", + "mKeyNo2": "Eichhörnchen", } self.assertStoredData(expectedData, "simple-data") @@ -75,6 +77,12 @@ def test_nested_data(self) -> None: }, "deeper-nested-2": "some value", }, + "mKeyNo1": "squirrel", + "mKeyNo2": { + "Translations": [ + -"Eichhörnchen" - "ardilla" - "écureuil" - "scoiattolo" + ] + }, } self.assertStoredData(expectedData, "nested-data")