You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "lordgamez (via GitHub)" <gi...@apache.org> on 2023/05/30 15:13:59 UTC

[GitHub] [nifi-minifi-cpp] lordgamez commented on a diff in pull request #1574: MINIFICPP-1641 Parallelization of docker tests

lordgamez commented on code in PR #1574:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1574#discussion_r1210416355


##########
docker/test/integration/features/MiNiFi_integration_test_driver.py:
##########
@@ -37,48 +40,68 @@
 
 
 class MiNiFi_integration_test:
-    def __init__(self, context):
-        self.test_id = context.test_id
-        self.cluster = DockerTestCluster(context)
+    def __init__(self, context, feature_id: str):
+        self.feature_id = feature_id
+        self.cluster = DockerTestCluster(context, feature_id=feature_id)
 
         self.connectable_nodes = []
         # Remote process groups are not connectables
         self.remote_process_groups = []
         self.file_system_observer = None
 
         self.docker_directory_bindings = context.directory_bindings
-        self.cluster.set_directory_bindings(self.docker_directory_bindings.get_directory_bindings(self.test_id), self.docker_directory_bindings.get_data_directories(self.test_id))
+        self.cluster.set_directory_bindings(self.docker_directory_bindings.get_directory_bindings(self.feature_id), self.docker_directory_bindings.get_data_directories(self.feature_id))
+        self.root_ca_cert, self.root_ca_key = make_ca("root CA")
+
+        minifi_client_cert, minifi_client_key = make_client_cert(common_name=f"minifi-cpp-flow-{self.feature_id}",
+                                                                 ca_cert=self.root_ca_cert,
+                                                                 ca_key=self.root_ca_key)
+        self.put_test_resource('root_ca.crt',
+                               OpenSSL.crypto.dump_certificate(type=OpenSSL.crypto.FILETYPE_PEM,
+                                                               cert=self.root_ca_cert))
+
+        self.put_test_resource('minifi_client.crt',
+                               OpenSSL.crypto.dump_certificate(type=OpenSSL.crypto.FILETYPE_PEM,
+                                                               cert=minifi_client_cert))
+        self.put_test_resource('minifi_client.key',
+                               OpenSSL.crypto.dump_privatekey(type=OpenSSL.crypto.FILETYPE_PEM,
+                                                              pkey=minifi_client_key))
+
+    def get_container_name_with_postfix(self, container_name: str):
+        return self.cluster.container_store.get_container_name_with_postfix(container_name)
 
     def cleanup(self):
         self.cluster.cleanup()
+        if self.file_system_observer:
+            self.file_system_observer.observer.unschedule_all()
 
-    def acquire_container(self, name, engine='minifi-cpp', command=None):
-        return self.cluster.acquire_container(name, engine, command)
+    def acquire_container(self, context, name, engine='minifi-cpp', command=None):

Review Comment:
   Is it necessary to pass the whole behave context in all of these functions? It seems that only the `feature_id` and ca cert paths are used in the containers. We could have a smaller feature specific context that could be passed around containing only the required test data.



##########
docker/test/integration/ssl_utils/SSL_cert_utils.py:
##########
@@ -110,7 +110,7 @@ def make_ca(common_name):
     return ca_cert, ca_key
 
 
-def make_cert(common_name, ca_cert, ca_key):
+def _make_cert(common_name, ca_cert, ca_key, is_server_auth=True, is_client_auth=True):

Review Comment:
   This should be changed to only allow either server or client authentication but not both.



##########
docker/DockerVerify.sh:
##########
@@ -26,18 +26,19 @@ die()
 }
 
 _positionals=()
-_arg_feature_path=('' )
 _arg_image_tag_prefix=
-_enable_test_processors=OFF
-
+_arg_tags_to_exclude=
+_arg_parallel_processes=3

Review Comment:
   Can we add a cmake option for the --parallel-processes argument to change the default locally when calling the `make docker-verify` command?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org