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

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

commit 5be21834c1dcd7901f745a758466bd0e3ea5b5a4
Author: Gabor Gyimesi <[email protected]>
AuthorDate: Thu Apr 13 18:16:49 2023 +0200

    MINIFICPP-2099 Only run tests requiring test processors if they are 
available
    
    Signed-off-by: Ferenc Gerlits <[email protected]>
    This closes #1557
---
 cmake/DockerConfig.cmake                                 | 12 ++++++------
 docker/DockerVerify.sh                                   | 16 +++++++++++++++-
 docker/test/integration/environment.py                   |  6 +++++-
 .../test/integration/features/core_functionality.feature |  3 +--
 4 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/cmake/DockerConfig.cmake b/cmake/DockerConfig.cmake
index 7740d2faf..df8ea6431 100644
--- a/cmake/DockerConfig.cmake
+++ b/cmake/DockerConfig.cmake
@@ -127,27 +127,27 @@ if (EXISTS 
${CMAKE_SOURCE_DIR}/docker/test/integration/features)
 
     add_custom_target(
         docker-verify-all
-        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ALL_BEHAVE_TESTS})
+        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
--enable_test_processors ON 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ALL_BEHAVE_TESTS})
 
     add_custom_target(
         docker-verify
-        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS})
+        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
--enable_test_processors ${ENABLE_TEST_PROCESSORS} 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS})
 
     add_custom_target(
         docker-verify-q1
-        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_FIRST_QUADRANT})
+        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
--enable_test_processors ${ENABLE_TEST_PROCESSORS} 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_FIRST_QUADRANT})
 
     add_custom_target(
         docker-verify-q2
-        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_SECOND_QUADRANT})
+        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
--enable_test_processors ${ENABLE_TEST_PROCESSORS} 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_SECOND_QUADRANT})
 
     add_custom_target(
         docker-verify-q3
-        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_THIRD_QUADRANT})
+        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
--enable_test_processors ${ENABLE_TEST_PROCESSORS} 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_THIRD_QUADRANT})
 
     add_custom_target(
         docker-verify-q4
-        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_LAST_QUADRANT})
+        COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh 
--enable_test_processors ${ENABLE_TEST_PROCESSORS} 
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} 
${ENABLED_BEHAVE_TESTS_LAST_QUADRANT})
 endif()
 
 include(VerifyPythonCompatibility)
diff --git a/docker/DockerVerify.sh b/docker/DockerVerify.sh
index c1cbd593c..49ea8fd6c 100755
--- a/docker/DockerVerify.sh
+++ b/docker/DockerVerify.sh
@@ -28,12 +28,13 @@ die()
 _positionals=()
 _arg_feature_path=('' )
 _arg_image_tag_prefix=
+_enable_test_processors=OFF
 
 
 print_help()
 {
   printf '%s\n' "Runs the provided behave tests in a containerized environment"
-  printf 'Usage: %s [--image-tag-prefix <arg>] [-h|--help] <minifi_version> 
<feature_path-1> [<feature_path-2>] ... [<feature_path-n>] ...\n' "$0"
+  printf 'Usage: %s [--image-tag-prefix <arg>] [--enable_test_processors 
<ON|OFF>] [-h|--help] <minifi_version> <feature_path-1> [<feature_path-2>] ... 
[<feature_path-n>] ...\n' "$0"
   printf '\t%s\n' "<minifi_version>: the version of minifi"
   printf '\t%s\n' "<feature_path>: feature files to run"
   printf '\t%s\n' "--image-tag-prefix: optional prefix to the docker tag (no 
default)"
@@ -56,6 +57,14 @@ parse_commandline()
       --image-tag-prefix=*)
         _arg_image_tag_prefix="${_key##--image-tag-prefix=}"
         ;;
+      --enable_test_processors)
+        test $# -lt 2 && die "Missing value for the optional argument 
'$_key'." 1
+        _enable_test_processors="$2"
+        shift
+        ;;
+      --enable_test_processors=*)
+        _enable_test_processors="${_key##--enable_test_processors=}"
+        ;;
       -h|--help)
         print_help
         exit 0
@@ -157,6 +166,11 @@ export TEST_DIRECTORY
 
 # Add --no-logcapture to see logs interleaved with the test output
 BEHAVE_OPTS=(-f pretty --logging-level INFO --logging-clear-handlers)
+if [[ "${_enable_test_processors}" == "ON" ]]; then
+  BEHAVE_OPTS+=(--define "test_processors=ON")
+else
+  BEHAVE_OPTS+=(--define "test_processors=OFF")
+fi
 
 # Specify feature or scenario to run a specific test e.g.:
 # behave "${BEHAVE_OPTS[@]}" "features/file_system_operations.feature"
diff --git a/docker/test/integration/environment.py 
b/docker/test/integration/environment.py
index 8f245afd2..3261b71c6 100644
--- a/docker/test/integration/environment.py
+++ b/docker/test/integration/environment.py
@@ -33,12 +33,16 @@ def before_scenario(context, scenario):
         scenario.skip("Marked with @skip")
         return
 
+    if "requires_test_processors" in scenario.effective_tags and 
context.config.userdata.get('test_processors') != "ON":
+        scenario.skip("Test processors are not available, skipping test 
scenario")
+        return
+
     logging.info("Integration test setup at 
{time:%H:%M:%S.%f}".format(time=datetime.datetime.now()))
     context.test = MiNiFi_integration_test(context)
 
 
 def after_scenario(context, scenario):
-    if "skip" in scenario.effective_tags:
+    if scenario.status == "skipped":
         logging.info("Scenario was skipped, no need for clean up.")
         return
 
diff --git a/docker/test/integration/features/core_functionality.feature 
b/docker/test/integration/features/core_functionality.feature
index 8802c8355..b6682d5ed 100644
--- a/docker/test/integration/features/core_functionality.feature
+++ b/docker/test/integration/features/core_functionality.feature
@@ -38,14 +38,13 @@ Feature: Core flow functionalities
     Then at least one flowfile with the content "first_custom_text" is placed 
in the monitored directory in less than 20 seconds
     And at least one flowfile with the content "second_custom_text" is placed 
in the monitored directory in less than 20 seconds
 
-
   Scenario: The default configuration uses RocksDB for both the flow file and 
content repositories
     Given a GenerateFlowFile processor with the "Data Format" property set to 
"Text"
     When the MiNiFi instance starts up
     Then the Minifi logs contain the following message: "Using plaintext 
FlowFileRepository" in less than 5 seconds
     And the Minifi logs contain the following message: "Using plaintext 
DatabaseContentRepository" in less than 1 second
 
-
+  @requires_test_processors
   Scenario: Processors are destructed when agent is stopped
     Given a transient MiNiFi flow with the name "transient-minifi" is set up
     And a LogOnDestructionProcessor processor with the name "logOnDestruction" 
in the "transient-minifi" flow

Reply via email to