[OOM-CMPv2] Refator names in oom-certservice-post-processor tests. 46/113146/3
authorJan Malkiewicz <jan.malkiewicz@nokia.com>
Fri, 25 Sep 2020 05:02:24 +0000 (07:02 +0200)
committerJan Malkiewicz <jan.malkiewicz@nokia.com>
Fri, 25 Sep 2020 05:57:02 +0000 (07:57 +0200)
Issue-ID: DCAEGEN2-2253
Signed-off-by: Jan Malkiewicz <jan.malkiewicz@nokia.com>
Change-Id: I6aa0bc0428724860b5538dc3e2d698e2023074e2

tests/oom-platform-cert-service/postprocessor/certservice-postprocessor-test.robot
tests/oom-platform-cert-service/postprocessor/libraries/PostProcessorDockerContainerUtils.py [moved from tests/oom-platform-cert-service/postprocessor/libraries/TrustMergerManager.py with 78% similarity]
tests/oom-platform-cert-service/postprocessor/resources/test-keywords.robot
tests/oom-platform-cert-service/postprocessor/resources/test-properties.robot

index 67d1af6..338f16f 100644 (file)
@@ -6,83 +6,83 @@ Resource          ./resources/test-keywords.robot
 
 *** Test Cases ***
 
-Trust Merger fails when file extension is invalid
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when file extension is invalid (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with invalid truststore extension env and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_INVALID_FILE_EXTENSION}  ${EXITCODE_CERTIFICATES_PATHS_VALIDATION_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_INVALID_FILE_EXTENSION}  ${EXITCODE_CERTIFICATES_PATHS_VALIDATION_EXCEPTION}
 
-Trust Merger fails when a variable is empty
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when a variable is empty (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with empty truststore password path env and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_EMPTY_PASSWORDS}  ${EXITCODE_CERTIFICATES_PATHS_VALIDATION_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_EMPTY_PASSWORDS}  ${EXITCODE_CERTIFICATES_PATHS_VALIDATION_EXCEPTION}
 
-Trust Merger fails when truststore and passwords envs not provided
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when truststore and passwords envs not provided (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with invalid empty envs and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_EMPTY}  ${EXITCODE_CONFIGURATION_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_EMPTY}  ${EXITCODE_CONFIGURATION_EXCEPTION}
 
-Trust Merger fails when list sizes are different
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when list sizes are different (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with different truststore and password envs size and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_INVALID_FILE_LIST_SIZE}  ${EXITCODE_CONFIGURATION_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_INVALID_FILE_LIST_SIZE}  ${EXITCODE_CONFIGURATION_EXCEPTION}
 
-Trust Merger fails when truststore paths are invalid
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when truststore paths are invalid (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with invalid truststore path and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_INVALID_TRUSTSTORE_PATHS}  ${EXITCODE_TRUSTSTORE_FILE_FACTORY_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_INVALID_TRUSTSTORE_PATHS}  ${EXITCODE_TRUSTSTORE_FILE_FACTORY_EXCEPTION}
 
-Trust Merger fails when password path is invalid
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when password path is invalid (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with invalid password path and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_INVALID_PASSWORD_PATHS}  ${EXITCODE_PASSWORD_READER_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_INVALID_PASSWORD_PATHS}  ${EXITCODE_PASSWORD_READER_EXCEPTION}
 
-Trust Merger fails when password file pair is invalid
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when password file pair is invalid (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with incorrect password env and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_INVALID_PASSWORD}  ${EXITCODE_TRUSTSTORE_LOAD_FILE_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_INVALID_PASSWORD}  ${EXITCODE_TRUSTSTORE_LOAD_FILE_EXCEPTION}
 
-Trust Merger fails when pem does not contain cert
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when pem does not contain cert (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with empty pem truststore and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_EMPTY_CERTS}  ${EXITCODE_MISSING_TRUSTSTORE_EXCEPTIONSUCCESS}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_EMPTY_CERTS}  ${EXITCODE_MISSING_TRUSTSTORE_EXCEPTIONSUCCESS}
 
-Trust Merger fails when aliases are duplicated
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when aliases are duplicated (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with duplicated aliases in truststores and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_DUPLICATED_ALIASES}  ${EXITCODE_ALIAS_CONFLICT_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_DUPLICATED_ALIASES}  ${EXITCODE_ALIAS_CONFLICT_EXCEPTION}
 
-Trust Merger merges successfully jks pem p12
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor merges successfully jks pem p12 (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with valid env file and expect merged certs from jks, pem and p12
-    Run Trust Merger And Merge Truststore Files To Jks  ${ENV_FILE_JKS_PEM_P12}  ${EXITCODE_SUCCESS}  ${JKS_TRUSTSTORE_MOUNT_PATH}  ${TRUSTSTORE_JKS_PASS}  ${JKS_TRUSTSTORE_EXPECTED_PATH}
+    Run Cert Service Post Processor And Merge Truststore Files To Jks  ${ENV_FILE_JKS_PEM_P12}  ${EXITCODE_SUCCESS}  ${JKS_TRUSTSTORE_MOUNT_PATH}  ${TRUSTSTORE_JKS_PASS}  ${JKS_TRUSTSTORE_EXPECTED_PATH}
 
-Trust Merger merges successfully pem p12
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor merges successfully pem p12 (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with valid env file and expect merged certs from pem and p12
-    Run Trust Merger And Merge Truststore Files To Pem  ${ENV_FILE_PEM_P12}  ${EXITCODE_SUCCESS}  ${PEM_TRUSTSTORE_MOUNT_PATH}  ${PEM_TRUSTSTORE_EXPECTED_PATH}
+    Run Cert Service Post Processor And Merge Truststore Files To Pem  ${ENV_FILE_PEM_P12}  ${EXITCODE_SUCCESS}  ${PEM_TRUSTSTORE_MOUNT_PATH}  ${PEM_TRUSTSTORE_EXPECTED_PATH}
 
-Trust Merger ends successfully with single truststore
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor ends successfully with single truststore (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with one truststore in env file and expect code 0
-    Run Trust Merger And Merge Truststore Files To Jks  ${ENV_FILE_SINGLE_TRUSTSTORE}  ${EXITCODE_SUCCESS}  ${JKS_TRUSTSTORE_MOUNT_PATH}  ${TRUSTSTORE_JKS_PASS}  ${TRUSTSTORE_JKS}
+    Run Cert Service Post Processor And Merge Truststore Files To Jks  ${ENV_FILE_SINGLE_TRUSTSTORE}  ${EXITCODE_SUCCESS}  ${JKS_TRUSTSTORE_MOUNT_PATH}  ${TRUSTSTORE_JKS_PASS}  ${TRUSTSTORE_JKS}
 
-Trust Merger fails when file to copy does not exist
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when file to copy does not exist (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with invalid extra optional env as a path to file and expect error code
-    Run Trust Merger And Expect Error  ${ENV_FILE_INVALID_KEYSTORE_SOURCE_PATHS}  ${EXITCODE_KEYSTORE_NOT_EXIST_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_INVALID_KEYSTORE_SOURCE_PATHS}  ${EXITCODE_KEYSTORE_NOT_EXIST_EXCEPTION}
 
-Trust Merger fails when only one extra optional env is set
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor fails when only one extra optional env is set (merger)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with empty extra optional env and expect code
-    Run Trust Merger And Expect Error  ${ENV_FILE_EMPTY_KEYSTORE_DESTINATION_PATH}  ${EXITCODE_CONFIGURATION_EXCEPTION}
+    Run Cert Service Post Processor And Expect Error  ${ENV_FILE_EMPTY_KEYSTORE_DESTINATION_PATH}  ${EXITCODE_CONFIGURATION_EXCEPTION}
 
-Trust Merger's Copier successfully backs up files
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor successfully backs up files (copier)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with valid env file and expect successfully backed up file
-    Run Trust Merger And Check Copied Keystore Files  ${ENV_FILE_EXTRA_OPTIONAL_ENVS}  ${EXITCODE_SUCCESS}  ${JKS_KEYSTORE_MOUNT_PATH}  ${KEYSTORE_JKS_PASS}  ${JKSBAK_KEYSTORE_EXPECTED_PATH}
+    Run Cert Service Post Processor And Check Copied Keystore Files  ${ENV_FILE_EXTRA_OPTIONAL_ENVS}  ${EXITCODE_SUCCESS}  ${JKS_KEYSTORE_MOUNT_PATH}  ${KEYSTORE_JKS_PASS}  ${JKSBAK_KEYSTORE_EXPECTED_PATH}
 
-Trust Merger's Copier successfully copies file
-    [Tags]      OOM-TRUST-STORE-MERGER
+Cert Post Processor successfully copies file (copier)
+    [Tags]      OOM-CERTSERVICE-POST-PROCESSOR
     [Documentation]  Run with valid env file and expect successfully copied file
-    Run Trust Merger And Check Copied Keystore Files  ${ENV_FILE_EXTRA_OPTIONAL_ENVS}  ${EXITCODE_SUCCESS}  ${JKS_KEYSTORE_MOUNT_PATH}  ${KEYSTORE_JKS_PASS}  ${JKS_KEYSTORE_EXPECTED_PATH}
+    Run Cert Service Post Processor And Check Copied Keystore Files  ${ENV_FILE_EXTRA_OPTIONAL_ENVS}  ${EXITCODE_SUCCESS}  ${JKS_KEYSTORE_MOUNT_PATH}  ${KEYSTORE_JKS_PASS}  ${JKS_KEYSTORE_EXPECTED_PATH}
 
@@ -7,20 +7,20 @@ from docker.types import Mount
 ARCHIVES_PATH = os.getenv("WORKSPACE") + "/archives/"
 
 
-class TrustMergerManager:
+class PostProcessorDockerContainerUtils:
 
   def __init__(self, mount_path, truststores_path):
     self.mount_path = mount_path
     self.truststores_path = truststores_path
 
-  def run_merger_container(self, merger_image, merger_name, path_to_env):
+  def run_container(self, docker_image, image_name, path_to_env):
     self.remove_mount_dir()
     shutil.copytree(self.truststores_path, self.mount_path)
     client = docker.from_env()
     environment = EnvsReader().read_env_list_from_file(path_to_env)
     container = client.containers.run(
-        image=merger_image,
-        name=merger_name,
+        image=docker_image,
+        name=image_name,
         environment=environment,
         user='root',  # Run container as root to avoid permission issues with volume mount access
         mounts=[Mount(target='/var/certs', source=self.mount_path, type='bind')],
@@ -37,10 +37,10 @@ class TrustMergerManager:
     if os.path.exists(self.mount_path):
       shutil.rmtree(self.mount_path)
 
-  def remove_merger_container_and_save_logs(self, container_name, log_file_name):
+  def remove_container_and_save_logs(self, container_name, log_file_name):
     client = docker.from_env()
     container = client.containers.get(container_name)
-    text_file = open(ARCHIVES_PATH + "merger_container_" + log_file_name + ".log", "w")
+    text_file = open(ARCHIVES_PATH + "certservice_postprocessor_container_" + log_file_name + ".log", "w")
     text_file.write(container.logs())
     text_file.close()
     container.remove()
index 514e239..404ec0a 100644 (file)
@@ -2,43 +2,43 @@
 
 Resource          ../../../common.robot
 Resource          ./test-properties.robot
-Library           ../libraries/TrustMergerManager.py  ${MOUNT_PATH}  ${TRUSTSTORES_PATH}
+Library           ../libraries/PostProcessorDockerContainerUtils.py  ${MOUNT_PATH}  ${TRUSTSTORES_PATH}
 Library           ../libraries/JksValidator.py
 Library           ../libraries/PemTruststoreValidator.py
 
 *** Keywords ***
 
-Run Trust Merger And Expect Error
-    [Documentation]  Run Truststore Merger Container And Validate Exit Code
+Run Cert Service Post Processor And Expect Error
+    [Documentation]  Run Cert Service Post Processor Container And Validate Exit Code
     [Arguments]   ${env_file}  ${expected_exit_code}
-    ${exit_code}=  Run Merger Container  ${DOCKER_MERGER_IMAGE}  ${MERGER_CONTAINER_NAME}  ${env_file}
-    Remove Merger Container And Save Logs  ${MERGER_CONTAINER_NAME}  negative_path
+    ${exit_code}=  Run Container  ${CERT_POST_PROCESSOR_DOCKER_IMAGE}  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  ${env_file}
+    Remove Container And Save Logs  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  negative_path
     Should Be Equal As Strings  ${exit_code}  ${expected_exit_code}  Client return unexpected exit code return: ${exitcode} , but expected: ${expected_exit_code}
 
-Run Trust Merger And Merge Truststore Files To Jks
-    [Documentation]  Run Truststore Merger Container And Validate Exit Code And Provided Truststore Files
+Run Cert Service Post Processor And Merge Truststore Files To Jks
+    [Documentation]  Run Cert Service Post Processor Container And Validate Exit Code And Provided Truststore Files
     [Arguments]  ${env_file}  ${expected_exit_code}  ${jks_path}  ${jks_password}  ${expected_jks_path}
-    ${exit_code}=  Run Merger Container  ${DOCKER_MERGER_IMAGE}  ${MERGER_CONTAINER_NAME}  ${env_file}
+    ${exit_code}=  Run Container  ${CERT_POST_PROCESSOR_DOCKER_IMAGE}  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  ${env_file}
     ${files_equal}=  Assert Jks Truststores Equal  ${jks_path}  ${jks_password}  ${expected_jks_path}
-    Remove Merger Container And Save Logs  ${MERGER_CONTAINER_NAME}  positive_path
+    Remove Container And Save Logs  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  positive_path
     Should Be Equal As Strings  ${exit_code}  ${expected_exit_code}  Client return unexpected exit code return: ${exitcode} , but expected: ${expected_exit_code}
     Should Be True  ${files_equal}
 
-Run Trust Merger And Check Copied Keystore Files
-    [Documentation]  Run Truststore Merger Container And Validate Exit Code And Provided Keystore Files
+Run Cert Service Post Processor And Check Copied Keystore Files
+    [Documentation]  Run Cert Service Post Processor Container And Validate Exit Code And Provided Keystore Files
     [Arguments]  ${env_file}  ${expected_exit_code}  ${jks_path}  ${jks_password}  ${expected_jks_path}
-    ${exit_code}=  Run Merger Container  ${DOCKER_MERGER_IMAGE}  ${MERGER_CONTAINER_NAME}  ${env_file}
+    ${exit_code}=  Run Container  ${CERT_POST_PROCESSOR_DOCKER_IMAGE}  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  ${env_file}
     ${files_equal}=  Assert Jks Keystores Equal  ${jks_path}  ${jks_password}  ${expected_jks_path}
-    Remove Merger Container And Save Logs  ${MERGER_CONTAINER_NAME}  positive_path
+    Remove Container And Save Logs  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  positive_path
     Should Be Equal As Strings  ${exit_code}  ${expected_exit_code}  Client return unexpected exit code return: ${exitcode} , but expected: ${expected_exit_code}
     Should Be True  ${files_equal}
 
-Run Trust Merger And Merge Truststore Files To Pem
-    [Documentation]  Run Truststore Merger Container And Validate Exit Code And Files
+Run Cert Service Post Processor And Merge Truststore Files To Pem
+    [Documentation]  Run Cert Service Post Processor Container And Validate Exit Code And Files
     [Arguments]  ${env_file}  ${expected_exit_code}  ${pem_path}  ${expected_pem_path}
-    ${exit_code}=  Run Merger Container  ${DOCKER_MERGER_IMAGE}  ${MERGER_CONTAINER_NAME}  ${env_file}
+    ${exit_code}=  Run Container  ${CERT_POST_PROCESSOR_DOCKER_IMAGE}  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  ${env_file}
     ${files_equal}=  Assert Pem Truststores Equal  ${pem_path}  ${expected_pem_path}
-    Remove Merger Container And Save Logs  ${MERGER_CONTAINER_NAME}  positive_path
+    Remove Container And Save Logs  ${CERT_POST_PROCESSOR_CONTAINER_NAME}  positive_path
     Should Be Equal As Strings  ${exit_code}  ${expected_exit_code}  Client return unexpected exit code return: ${exitcode} , but expected: ${expected_exit_code}
     Should Be True  ${files_equal}
 
index ab4c18b..80fc06a 100644 (file)
@@ -1,7 +1,7 @@
 *** Variables ***
 
-${DOCKER_MERGER_IMAGE}                                nexus3.onap.org:10001/onap/org.onap.oom.platform.cert-service.oom-certservice-post-processor:latest
-${MERGER_CONTAINER_NAME}                              %{CertServicePostProcessorContainerName}
+${CERT_POST_PROCESSOR_DOCKER_IMAGE}                   nexus3.onap.org:10001/onap/org.onap.oom.platform.cert-service.oom-certservice-post-processor:latest
+${CERT_POST_PROCESSOR_CONTAINER_NAME}                 %{CertServicePostProcessorContainerName}
 ${BASE_PATH}                                          %{WORKSPACE}/tests/oom-platform-cert-service/postprocessor
 ${MOUNT_PATH}                                         ${BASE_PATH}/tmp
 ${TRUSTSTORES_PATH}                                   ${BASE_PATH}/assets/truststores