From 9008fc5ddaee008880cdd9ca4a66fd01f123c8c7 Mon Sep 17 00:00:00 2001 From: pwielebs Date: Wed, 16 Sep 2020 14:08:59 +0200 Subject: Add CSITs for Truststore Merger - Copier functionality Negative scenarios: - KEYSTORE_SOURCE_PATHS points to file which does not exist - KEYSTORE_DESTINATION_PATHS is not present Positive scenarios: - Copier produce BAK file Issue-ID: DCAEGEN2-2253 Signed-off-by: pwielebs Change-Id: Idd4c433b70b261ea96812874a7196ba236e5d586 --- .../assets/expected_keystores/keystore.jks | Bin 0 -> 2560 bytes .../assets/expected_keystores/keystore.jks.bak | Bin 0 -> 2560 bytes .../invalid_empty_keystore_destination_path.env | 3 +++ .../assets/invalid_keystore_source_paths.env | 4 ++++ .../assets/truststores/external/keystore.jks | Bin 0 -> 2560 bytes .../assets/truststores/external/keystore.pass | 1 + .../assets/valid_envs_and_extra_optional.env | 4 ++++ .../resources/trust-merger-keywords.robot | 1 + .../resources/trust-merger-properties.robot | 8 ++++++++ .../truststoremerger/trust-merger-test.robot | 21 +++++++++++++++++++++ 10 files changed, 42 insertions(+) create mode 100644 tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks create mode 100644 tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks.bak create mode 100644 tests/oom-platform-cert-service/truststoremerger/assets/invalid_empty_keystore_destination_path.env create mode 100644 tests/oom-platform-cert-service/truststoremerger/assets/invalid_keystore_source_paths.env create mode 100644 tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.jks create mode 100644 tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.pass create mode 100644 tests/oom-platform-cert-service/truststoremerger/assets/valid_envs_and_extra_optional.env diff --git a/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks b/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks new file mode 100644 index 00000000..390f2410 Binary files /dev/null and b/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks differ diff --git a/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks.bak b/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks.bak new file mode 100644 index 00000000..390f2410 Binary files /dev/null and b/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks.bak differ diff --git a/tests/oom-platform-cert-service/truststoremerger/assets/invalid_empty_keystore_destination_path.env b/tests/oom-platform-cert-service/truststoremerger/assets/invalid_empty_keystore_destination_path.env new file mode 100644 index 00000000..526357b0 --- /dev/null +++ b/tests/oom-platform-cert-service/truststoremerger/assets/invalid_empty_keystore_destination_path.env @@ -0,0 +1,3 @@ +TRUSTSTORES_PATHS=/var/certs/truststore.jks:/var/certs/truststore.pem:/var/certs/truststore.p12 +TRUSTSTORES_PASSWORDS_PATHS=/var/certs/truststoreJks.pass::/var/certs/truststoreP12.pass +KEYSTORE_SOURCE_PATHS=/var/certs/external/keystore13.jks diff --git a/tests/oom-platform-cert-service/truststoremerger/assets/invalid_keystore_source_paths.env b/tests/oom-platform-cert-service/truststoremerger/assets/invalid_keystore_source_paths.env new file mode 100644 index 00000000..7090151c --- /dev/null +++ b/tests/oom-platform-cert-service/truststoremerger/assets/invalid_keystore_source_paths.env @@ -0,0 +1,4 @@ +TRUSTSTORES_PATHS=/var/certs/truststore.jks:/var/certs/truststore.pem:/var/certs/truststore.p12 +TRUSTSTORES_PASSWORDS_PATHS=/var/certs/truststoreJks.pass::/var/certs/truststoreP12.pass +KEYSTORE_SOURCE_PATHS=/var/certs/external/keystore13.jks +KEYSTORE_DESTINATION_PATHS=/var/certs/cert.jks diff --git a/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.jks b/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.jks new file mode 100644 index 00000000..390f2410 Binary files /dev/null and b/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.jks differ diff --git a/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.pass b/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.pass new file mode 100644 index 00000000..8b11c5b6 --- /dev/null +++ b/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.pass @@ -0,0 +1 @@ +wgg2_fLSQ8I4sLfyUOCC7uYn \ No newline at end of file diff --git a/tests/oom-platform-cert-service/truststoremerger/assets/valid_envs_and_extra_optional.env b/tests/oom-platform-cert-service/truststoremerger/assets/valid_envs_and_extra_optional.env new file mode 100644 index 00000000..928bf637 --- /dev/null +++ b/tests/oom-platform-cert-service/truststoremerger/assets/valid_envs_and_extra_optional.env @@ -0,0 +1,4 @@ +TRUSTSTORES_PATHS=/var/certs/truststore.pem:/var/certs/truststore.p12 +TRUSTSTORES_PASSWORDS_PATHS=:/var/certs/truststoreP12.pass +KEYSTORE_SOURCE_PATHS=/var/certs/external/keystore.jks:/var/certs/external/keystore.pass +KEYSTORE_DESTINATION_PATHS=/var/certs/keystore.jks:/var/certs/keystore.pass diff --git a/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-keywords.robot b/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-keywords.robot index 1040afab..5aba7fea 100644 --- a/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-keywords.robot +++ b/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-keywords.robot @@ -32,3 +32,4 @@ Run Trust Merger And Merge Truststore Files To Pem Remove Merger Container And Save Logs ${MERGER_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} + diff --git a/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-properties.robot b/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-properties.robot index 3aa4a18f..a2e62f81 100644 --- a/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-properties.robot +++ b/tests/oom-platform-cert-service/truststoremerger/resources/trust-merger-properties.robot @@ -11,9 +11,12 @@ ${JKS_PASSWORD_MOUNT_PATH} %{WORKSPACE}/tests/oom-pla ${P12_TRUSTSTORE_MOUNT_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/tmp/truststore.p12 ${P12_PASSWORD_MOUNT_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/tmp/truststoreP12.pass ${PEM_TRUSTSTORE_MOUNT_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/tmp/truststore.pem +${JKS_KEYSTORE_MOUNT_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/tmp/external/keystore.jks ${JKS_TRUSTSTORE_EXPECTED_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/expected_truststores/jksAndPemAndP12.jks ${PEM_TRUSTSTORE_EXPECTED_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/expected_truststores/pemAndP12.pem +${JKSBAK_KEYSTORE_EXPECTED_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks.bak +${JKS_KEYSTORE_EXPECTED_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/expected_keystores/keystore.jks ${INVALID_ENV_FILE_EMPTY} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/invalid_empty_file.env ${INVALID_ENV_FILE_LIST_SIZE} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/invalid_different_lists_size.env @@ -27,7 +30,12 @@ ${INVALID_ENV_FILE_EMPTY_CERTS} %{WORKSPACE}/tests/oom-pla ${VALID_ENV_FILE_JKS_PEM_P12} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/valid_jks_pem_p12.env ${VALID_ENV_FILE_PEM_P12} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/valid_pem_p12.env ${VALID_ENV_FILE_SINGLE_TRUSTSTORE} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/valid_single_truststore.env +${INVALID_KEYSTORE_SOURCE_PATHS} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/invalid_keystore_source_paths.env +${INVALID_EMPTY_KEYSTORE_DESTINATION_PATH} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/invalid_empty_keystore_destination_path.env +${VALID_ENVS_AND_EXTRA_OPTIONAL_ENVS} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/valid_envs_and_extra_optional.env +${KEYSTORE_JKS} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.jks +${KEYSTORE_JKS_PASS} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/truststores/external/keystore.pass ${TRUSTSTORE_JKS} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/truststores/truststore.jks ${TRUSTSTORE_JKS_PASS} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/truststores/truststoreJks.pass ${TRUSTSTORE_P12} %{WORKSPACE}/tests/oom-platform-cert-service/truststoremerger/assets/truststores/truststore.p12 diff --git a/tests/oom-platform-cert-service/truststoremerger/trust-merger-test.robot b/tests/oom-platform-cert-service/truststoremerger/trust-merger-test.robot index 21323d87..2b84d2ab 100644 --- a/tests/oom-platform-cert-service/truststoremerger/trust-merger-test.robot +++ b/tests/oom-platform-cert-service/truststoremerger/trust-merger-test.robot @@ -65,3 +65,24 @@ Trust Merger ends successfully with single truststore [Tags] OOM-TRUST-STORE-MERGER [Documentation] Run with one truststore in env file and expect code 0 Run Trust Merger And Merge Truststore Files To Jks ${VALID_ENV_FILE_SINGLE_TRUSTSTORE} 0 ${JKS_TRUSTSTORE_MOUNT_PATH} ${TRUSTSTORE_JKS_PASS} ${TRUSTSTORE_JKS} + +Trust Merger fails when file to copy does not exist + [Tags] OOM-TRUST-STORE-MERGER + [Documentation] Run with invalid extra optional env as a path to file and expect error code + Run Trust Merger And Expect Error ${INVALID_KEYSTORE_SOURCE_PATHS} 13 + +Trust Merger fails when only one extra optional env is set + [Tags] OOM-TRUST-STORE-MERGER + [Documentation] Run with empty extra optional env and expect code + Run Trust Merger And Expect Error ${INVALID_EMPTY_KEYSTORE_DESTINATION_PATH} 2 + +Trust Merger's Copier successfully backs up files + [Tags] OOM-TRUST-STORE-MERGER + [Documentation] Run with valid env file and expect successfully backed up file + Run Trust Merger And Merge Truststore Files To Jks ${VALID_ENVS_AND_EXTRA_OPTIONAL_ENVS} 0 ${JKS_KEYSTORE_MOUNT_PATH} ${KEYSTORE_JKS_PASS} ${JKSBAK_KEYSTORE_EXPECTED_PATH} + +Trust Merger's Copier successfully copies file + [Tags] OOM-TRUST-STORE-MERGER + [Documentation] Run with valid env file and expect successfully copied file + Run Trust Merger And Merge Truststore Files To Jks ${VALID_ENVS_AND_EXTRA_OPTIONAL_ENVS} 0 ${JKS_KEYSTORE_MOUNT_PATH} ${KEYSTORE_JKS_PASS} ${JKS_KEYSTORE_EXPECTED_PATH} + -- cgit 1.2.3-korg