This is an automated email from the ASF dual-hosted git repository.

martinzink pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 4c080323a0484934cef2a1e9614bc19432c21708
Author: Gabor Gyimesi <gamezb...@gmail.com>
AuthorDate: Mon Jun 24 15:54:01 2024 +0200

    MINIFICPP-2419 Fix splunk docker tests
    
    Closes #1827
    
    Signed-off-by: Martin Zink <martinz...@apache.org>
---
 .../test/integration/cluster/DockerTestCluster.py   |  4 ----
 .../integration/cluster/checkers/SplunkChecker.py   | 21 +--------------------
 .../features/MiNiFi_integration_test_driver.py      |  6 ------
 docker/test/integration/features/splunk.feature     |  4 ----
 docker/test/integration/features/steps/steps.py     |  6 ------
 .../integration/minifi/processors/PutSplunkHTTP.py  |  3 ++-
 .../minifi/processors/QuerySplunkIndexingStatus.py  |  3 ++-
 .../integration/resources/splunk-hec/Dockerfile     |  2 +-
 8 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/docker/test/integration/cluster/DockerTestCluster.py 
b/docker/test/integration/cluster/DockerTestCluster.py
index 04205a64a..c54fb8ab2 100644
--- a/docker/test/integration/cluster/DockerTestCluster.py
+++ b/docker/test/integration/cluster/DockerTestCluster.py
@@ -228,10 +228,6 @@ class DockerTestCluster:
         container_name = 
self.container_store.get_container_name_with_postfix(container_name)
         return self.splunk_checker.enable_splunk_hec_ssl(container_name, 
splunk_cert_pem, splunk_key_pem, root_ca_cert_pem)
 
-    def get_splunk_token(self, container_name, hec_name):
-        container_name = 
self.container_store.get_container_name_with_postfix(container_name)
-        return self.splunk_checker.get_splunk_token(container_name, hec_name)
-
     def check_google_cloud_storage(self, gcs_container_name, content):
         gcs_container_name = 
self.container_store.get_container_name_with_postfix(gcs_container_name)
         return self.gcs_checker.check_google_cloud_storage(gcs_container_name, 
content)
diff --git a/docker/test/integration/cluster/checkers/SplunkChecker.py 
b/docker/test/integration/cluster/checkers/SplunkChecker.py
index 12125bdf1..8cc2e2758 100644
--- a/docker/test/integration/cluster/checkers/SplunkChecker.py
+++ b/docker/test/integration/cluster/checkers/SplunkChecker.py
@@ -58,7 +58,7 @@ class SplunkChecker:
     def enable_splunk_hec_indexer(self, container_name, hec_name):
         (code, _) = 
self.container_communicator.execute_command(container_name, ["sudo",
                                                                                
  "/opt/splunk/bin/splunk", "http-event-collector",
-                                                                               
  "create", hec_name,
+                                                                               
  "update", hec_name,
                                                                                
  "-uri", "https://localhost:8089";,
                                                                                
  "-use-ack", "1",
                                                                                
  "-disabled", "0",
@@ -78,22 +78,3 @@ class SplunkChecker:
                                                                                
  "-require-client-cert", "1",
                                                                                
  "-auth", "admin:splunkadmin"])
         return code == 0
-
-    def get_splunk_token(self, container_name, hec_name):
-        (code, output) = 
self.container_communicator.execute_command(container_name, ["sudo",
-                                                                               
       "/opt/splunk/bin/splunk", "http-event-collector",
-                                                                               
       "list",
-                                                                               
       "-uri", "https://localhost:8089";,
-                                                                               
       "-auth", "admin:splunkadmin"])
-        if code != 0:
-            return None
-        output_lines = output.splitlines()
-        hec_name_found = False
-        for output_line in output_lines:
-            if hec_name_found:
-                if "token=" in output_line:
-                    return "Splunk " + output_line.split("=")[1].strip()
-            else:
-                if hec_name in output_line:
-                    hec_name_found = True
-        return None
diff --git a/docker/test/integration/features/MiNiFi_integration_test_driver.py 
b/docker/test/integration/features/MiNiFi_integration_test_driver.py
index 2dad89e20..a80a50ebd 100644
--- a/docker/test/integration/features/MiNiFi_integration_test_driver.py
+++ b/docker/test/integration/features/MiNiFi_integration_test_driver.py
@@ -116,12 +116,6 @@ class MiNiFi_integration_test:
         assert self.cluster.wait_for_container_startup_to_finish('splunk')
         assert self.cluster.enable_splunk_hec_indexer('splunk', 
'splunk_hec_token')
 
-    def get_splunk_token(self):
-        token = self.cluster.get_splunk_token('splunk', 'splunk_hec_token')
-        if token is None:
-            raise Exception("Failed to get Splunk token")
-        return token
-
     def start_elasticsearch(self, context):
         self.cluster.acquire_container(context=context, name='elasticsearch', 
engine='elasticsearch')
         self.cluster.deploy_container('elasticsearch')
diff --git a/docker/test/integration/features/splunk.feature 
b/docker/test/integration/features/splunk.feature
index 0de8fe2b3..a6f99285e 100644
--- a/docker/test/integration/features/splunk.feature
+++ b/docker/test/integration/features/splunk.feature
@@ -25,9 +25,7 @@ Feature: Sending data to Splunk HEC using PutSplunkHTTP
     And a GetFile processor with the "Input Directory" property set to 
"/tmp/input"
     And a file with the content "foobar" is present in "/tmp/input"
     And a PutSplunkHTTP processor set up to communicate with the Splunk HEC 
instance
-    And the Splunk token property is set for the PutSplunkHTTP processor
     And a QuerySplunkIndexingStatus processor set up to communicate with the 
Splunk HEC Instance
-    And the Splunk token property is set for the QuerySplunkIndexingStatus 
processor
     And the "Splunk Request Channel" properties of the PutSplunkHTTP and 
QuerySplunkIndexingStatus processors are set to the same random guid
     And the "Source" property of the PutSplunkHTTP processor is set to 
"my-source"
     And the "Source Type" property of the PutSplunkHTTP processor is set to 
"my-source-type"
@@ -50,9 +48,7 @@ Feature: Sending data to Splunk HEC using PutSplunkHTTP
     And a GetFile processor with the "Input Directory" property set to 
"/tmp/input"
     And a file with the content "foobar" is present in "/tmp/input"
     And a PutSplunkHTTP processor set up to communicate with the Splunk HEC 
instance
-    And the Splunk token property is set for the PutSplunkHTTP processor
     And a QuerySplunkIndexingStatus processor set up to communicate with the 
Splunk HEC Instance
-    And the Splunk token property is set for the QuerySplunkIndexingStatus 
processor
     And the "Splunk Request Channel" properties of the PutSplunkHTTP and 
QuerySplunkIndexingStatus processors are set to the same random guid
     And the "Source" property of the PutSplunkHTTP processor is set to 
"my-source"
     And the "Source Type" property of the PutSplunkHTTP processor is set to 
"my-source-type"
diff --git a/docker/test/integration/features/steps/steps.py 
b/docker/test/integration/features/steps/steps.py
index 4ca2fae96..47d27430b 100644
--- a/docker/test/integration/features/steps/steps.py
+++ b/docker/test/integration/features/steps/steps.py
@@ -527,12 +527,6 @@ def step_impl(context):
     context.test.start_splunk(context)
 
 
-@given("the Splunk token property is set for the {processor_name} processor")
-def step_impl(context, processor_name):
-    token = context.test.get_splunk_token()
-    context.execute_steps(f"given the \"Token\" property of the 
{processor_name} processor is set to \"{token}\"")
-
-
 # TCP client
 @given('a TCP client is set up to send a test TCP message to minifi')
 def step_impl(context):
diff --git a/docker/test/integration/minifi/processors/PutSplunkHTTP.py 
b/docker/test/integration/minifi/processors/PutSplunkHTTP.py
index e34f09cc6..1bf26e59d 100644
--- a/docker/test/integration/minifi/processors/PutSplunkHTTP.py
+++ b/docker/test/integration/minifi/processors/PutSplunkHTTP.py
@@ -24,7 +24,8 @@ class PutSplunkHTTP(Processor):
             clazz='PutSplunkHTTP',
             properties={
                 'Hostname': 'splunk',
-                'Port': '8088'
+                'Port': '8088',
+                'Token': 'Splunk 176fae97-f59d-4f08-939a-aa6a543f2485'  # 
Token of the default splunk_hec_token HTTP Event Collector in the Splunk 
container image
             },
             auto_terminate=['success', 'failure'],
             schedule=schedule)
diff --git 
a/docker/test/integration/minifi/processors/QuerySplunkIndexingStatus.py 
b/docker/test/integration/minifi/processors/QuerySplunkIndexingStatus.py
index 2642666d5..e4638cec8 100644
--- a/docker/test/integration/minifi/processors/QuerySplunkIndexingStatus.py
+++ b/docker/test/integration/minifi/processors/QuerySplunkIndexingStatus.py
@@ -24,7 +24,8 @@ class QuerySplunkIndexingStatus(Processor):
             clazz='QuerySplunkIndexingStatus',
             properties={
                 'Hostname': 'splunk',
-                'Port': '8088'
+                'Port': '8088',
+                'Token': 'Splunk 176fae97-f59d-4f08-939a-aa6a543f2485'  # 
Token of the default splunk_hec_token HTTP Event Collector in the Splunk 
container image
             },
             auto_terminate=['acknowledged', 'unacknowledged', 'undetermined', 
'failure'],
             schedule=schedule)
diff --git a/docker/test/integration/resources/splunk-hec/Dockerfile 
b/docker/test/integration/resources/splunk-hec/Dockerfile
index af6ea5ab2..a56160096 100644
--- a/docker/test/integration/resources/splunk-hec/Dockerfile
+++ b/docker/test/integration/resources/splunk-hec/Dockerfile
@@ -1,2 +1,2 @@
-FROM splunk/splunk:9.0
+FROM splunk/splunk:9.2.1-patch2
 ADD conf/default.yml /tmp/defaults/default.yml

Reply via email to