martinzink commented on code in PR #2089:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2089#discussion_r2815509172


##########
behave_framework/src/minifi_test_framework/containers/minifi_container.py:
##########
@@ -96,6 +97,35 @@ def set_log_property(self, key: str, value: str):
     def enable_openssl_fips_mode(self):
         self.properties["nifi.openssl.fips.support.enable"] = "true"
 
+    def enable_c2(self):
+        self.properties["nifi.c2.enable"] = "true"
+        self.properties["nifi.c2.rest.url"] = 
f"http://minifi-c2-server-{self.scenario_id}:10090/c2/config/heartbeat";
+        self.properties["nifi.c2.rest.url.ack"] = 
f"http://minifi-c2-server-{self.scenario_id}:10090/c2/config/acknowledge";
+        self.properties["nifi.c2.flow.base.url"] = 
f"http://minifi-c2-server-{self.scenario_id}:10090/c2/config/";
+        self.properties["nifi.c2.root.classes"] = 
"DeviceInfoNode,AgentInformation,FlowInformation,AssetInformation"
+        self.properties["nifi.c2.full.heartbeat"] = "false"
+        self.properties["nifi.c2.agent.class"] = "minifi-test-class"
+        self.properties["nifi.c2.agent.identifier"] = "minifi-test-id"
+
+    def enable_c2_with_ssl(self):
+        self.properties["nifi.c2.enable"] = "true"
+        self.properties["nifi.c2.rest.url"] = 
f"https://minifi-c2-server-{self.scenario_id}:10090/c2/config/heartbeat";
+        self.properties["nifi.c2.rest.url.ack"] = 
f"https://minifi-c2-server-{self.scenario_id}:10090/c2/config/acknowledge";
+        self.properties["nifi.c2.flow.base.url"] = 
f"https://minifi-c2-server-{self.scenario_id}:10090/c2/config/";
+        self.properties["nifi.c2.root.classes"] = 
"DeviceInfoNode,AgentInformation,FlowInformation,AssetInformation"
+        self.properties["nifi.c2.full.heartbeat"] = "false"
+        self.properties["nifi.c2.agent.class"] = "minifi-test-class"
+        self.properties["nifi.c2.agent.identifier"] = "minifi-test-id"

Review Comment:
   these feel like domain specific functions so they would be better left at 
the extension level not at the framework



##########
behave_framework/src/minifi_test_framework/steps/checking_steps.py:
##########
@@ -246,6 +246,14 @@ def step_impl(context, container_name: str, directory: 
str, size: str, duration:
 
 
 @then("at least one file with minimum size of \"{size}\" is placed in the 
\"{directory}\" directory in less than {duration}")
-def step_impl(context, directory: str, size: str, duration: str):
+def step_impl(context: MinifiTestContext, directory: str, size: str, duration: 
str):
     context.execute_steps(
         f'Then in the "{DEFAULT_MINIFI_CONTAINER_NAME}" container at least one 
file with minimum size of "{size}" is placed in the "{directory}" directory in 
less than {duration}')
+
+
+@then("the MiNiFi C2 server logs contain the following message: 
\"{log_message}\" in less than {duration}")
+def step_impl(context: MinifiTestContext, log_message: str, duration: str):
+    duration_seconds = humanfriendly.parse_timespan(duration)
+    assert wait_for_condition(condition=lambda: log_message in 
context.containers["minifi-c2-server"].get_logs(),
+                              timeout_seconds=duration_seconds, 
bail_condition=lambda: context.containers["minifi-c2-server"].exited,
+                              context=context)

Review Comment:
   here aswell it might be better to put this in the standard processors 
steps.py not here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to