You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by lo...@apache.org on 2024/10/30 09:52:03 UTC
(nifi-minifi-cpp) 09/15: Refactor tests
This is an automated email from the ASF dual-hosted git repository.
lordgamez pushed a commit to branch MINIFICPP-2469
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 57d1c6403eb5bc877add814cbbe7a8a82af5c5af
Author: Gabor Gyimesi <ga...@gmail.com>
AuthorDate: Mon Oct 21 13:56:36 2024 +0200
Refactor tests
---
docker/test/integration/features/couchbase.feature | 12 ++++++------
docker/test/integration/features/steps/steps.py | 14 ++++----------
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/docker/test/integration/features/couchbase.feature b/docker/test/integration/features/couchbase.feature
index f4e352cbe..446821f25 100644
--- a/docker/test/integration/features/couchbase.feature
+++ b/docker/test/integration/features/couchbase.feature
@@ -19,14 +19,14 @@ Feature: Executing Couchbase operations from MiNiFi-C++
Given the content of "/tmp/output" is monitored
Scenario: A MiNiFi instance can insert json data to test bucket with PutCouchbaseKey processor
- Given a Couchbase server is set up
- And a GetFile processor with the "Input Directory" property set to "/tmp/input"
+ Given a GetFile processor with the "Input Directory" property set to "/tmp/input"
And a file with the content '{"field1": "value1", "field2": "value2"}' is present in '/tmp/input'
And a PutCouchbaseKey processor with the "Bucket Name" property set to "test_bucket"
And the "Document Id" property of the PutCouchbaseKey processor is set to "test_doc_id"
And the "Document Type" property of the PutCouchbaseKey processor is set to "Json"
+ And the "Couchbase Cluster Controller Service" property of the PutCouchbaseKey processor is set to "CouchbaseClusterService"
And a LogAttribute processor with the "FlowFiles To Log" property set to "0"
- And a CouchbaseClusterService is setup up for PutCouchbaseKey with the name "CouchbaseClusterService"
+ And a CouchbaseClusterService is setup up with the name "CouchbaseClusterService"
And the "success" relationship of the GetFile processor is connected to the PutCouchbaseKey
And the "success" relationship of the PutCouchbaseKey processor is connected to the LogAttribute
@@ -43,14 +43,14 @@ Feature: Executing Couchbase operations from MiNiFi-C++
And a document with id "test_doc_id" in bucket "test_bucket" is present with data '{"field1": "value1", "field2": "value2"}' of type "Json" in Couchbase
Scenario: A MiNiFi instance can insert binary data to test bucket with PutCouchbaseKey processor
- Given a Couchbase server is set up
- And a GetFile processor with the "Input Directory" property set to "/tmp/input"
+ Given a GetFile processor with the "Input Directory" property set to "/tmp/input"
And a file with the content '{"field1": "value1"}' is present in '/tmp/input'
And a PutCouchbaseKey processor with the "Bucket Name" property set to "test_bucket"
And the "Document Id" property of the PutCouchbaseKey processor is set to "test_doc_id"
And the "Document Type" property of the PutCouchbaseKey processor is set to "Binary"
+ And the "Couchbase Cluster Controller Service" property of the PutCouchbaseKey processor is set to "CouchbaseClusterService"
And a LogAttribute processor with the "FlowFiles To Log" property set to "0"
- And a CouchbaseClusterService is setup up for PutCouchbaseKey with the name "CouchbaseClusterService"
+ And a CouchbaseClusterService is setup up with the name "CouchbaseClusterService"
And the "success" relationship of the GetFile processor is connected to the PutCouchbaseKey
And the "success" relationship of the PutCouchbaseKey processor is connected to the LogAttribute
diff --git a/docker/test/integration/features/steps/steps.py b/docker/test/integration/features/steps/steps.py
index 0a76672c3..a6909926e 100644
--- a/docker/test/integration/features/steps/steps.py
+++ b/docker/test/integration/features/steps/steps.py
@@ -1359,24 +1359,18 @@ def step_impl(context, modbus_cmd):
# Couchbase
-@given("a Couchbase server is set up")
-def step_impl(context):
- context.test.acquire_container(context=context, name="couchbase-server", engine="couchbase-server")
-
-
@when(u'a Couchbase server is started')
def step_impl(context):
context.test.start_couchbase_server(context)
-@given("a CouchbaseClusterService is setup up for {processor_name} with the name \"{service_name}\"")
-def step_impl(context, processor_name, service_name):
+@given("a CouchbaseClusterService is setup up with the name \"{service_name}\"")
+def step_impl(context, service_name):
couchbase_cluster_controller_service = CouchbaseClusterService(
name=service_name,
connection_string="couchbase://{server_hostname}".format(server_hostname=context.test.get_container_name_with_postfix("couchbase-server")))
- processor = context.test.get_node_by_name(processor_name)
- processor.controller_services.append(couchbase_cluster_controller_service)
- processor.set_property("Couchbase Cluster Controller Service", couchbase_cluster_controller_service.name)
+ container = context.test.acquire_container(context=context, name="minifi-cpp-flow")
+ container.add_controller(couchbase_cluster_controller_service)
@then("a document with id \"{doc_id}\" in bucket \"{bucket_name}\" is present with data '{data}' of type \"{data_type}\" in Couchbase")