aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--plans/oom-platform-cert-service/certservice/setup.sh4
-rw-r--r--tests/common.robot1
-rw-r--r--tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py2
-rw-r--r--tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py3
-rw-r--r--tests/oom-platform-cert-service/certservice/libraries/ResponseParser.py9
-rw-r--r--tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot9
-rw-r--r--tests/oom-platform-cert-service/postprocessor/libraries/JksValidator.py3
-rw-r--r--tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py3
-rw-r--r--tests/oom-platform-cert-service/postprocessor/libraries/PostProcessorDockerContainerUtils.py2
10 files changed, 23 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index de8eea83..bf0a425b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@ env.properties
/tests/aaf/certservice/tmp/*
/tests/oom-platform-cert-service/postprocessor/tmp/*
+.robot3_venv
diff --git a/plans/oom-platform-cert-service/certservice/setup.sh b/plans/oom-platform-cert-service/certservice/setup.sh
index 0e2a4653..4219bf69 100644
--- a/plans/oom-platform-cert-service/certservice/setup.sh
+++ b/plans/oom-platform-cert-service/certservice/setup.sh
@@ -38,7 +38,7 @@ pip install -U docker==2.7.0
#reinstall pyopenssl library
echo "Reinstall pyopenssl library."
pip uninstall pyopenssl -y
-pip install pyopenssl==17.5.0
+pip install pyopenssl==23.0.0
#install pyjks for .jks files management
pip install pyjks
@@ -92,7 +92,7 @@ for i in {1..9}
do
OOMCERT_IP=`get-instance-ip.sh oomcert-service`
RESP_CODE=$(curl -s https://localhost:8443/actuator/health --cacert ./certs/root.crt --cert-type p12 --cert ./certs/certServiceServer-keystore.p12 --pass secret | \
- python2 -c 'import json,sys;obj=json.load(sys.stdin);print obj["status"]')
+ python3 -c 'import json,sys;obj=json.load(sys.stdin);print (obj["status"])')
if [[ "$RESP_CODE" == "UP" ]]; then
echo 'OOM Cert Service is ready'
export OOMCERT_IP=${OOMCERT_IP}
diff --git a/tests/common.robot b/tests/common.robot
index f0dea255..8af66a5d 100644
--- a/tests/common.robot
+++ b/tests/common.robot
@@ -1,7 +1,6 @@
#Robot functions that will be shared also with other tests
*** Settings ***
Library OperatingSystem
-Library HttpLibrary.HTTP
*** Keywords ***
json_from_file
diff --git a/tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py b/tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py
index bc796ed6..35e11011 100644
--- a/tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py
+++ b/tests/oom-platform-cert-service/certservice/libraries/ArtifactParser.py
@@ -37,7 +37,7 @@ class ArtifactParser:
return SANS_DELIMITER.join(sans_strings)
def remove_nones_from_dict(self, dictionary):
- return dict((k, v) for k, v in dictionary.iteritems() if k is not None)
+ return dict((k, v) for k, v in dictionary.items() if k is not None)
def get_list_of_pairs_by_mappings(self, list):
mappings = self.get_mappings()
diff --git a/tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py b/tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py
index 46d69bb8..1c957f13 100644
--- a/tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py
+++ b/tests/oom-platform-cert-service/certservice/libraries/CertClientManager.py
@@ -21,6 +21,7 @@ class CertClientManager:
self.create_mount_dir()
client = docker.from_env()
environment = EnvsReader().read_env_list_from_file(path_to_env)
+
environment.append("REQUEST_URL=" + request_url)
container = client.containers.run(
image=client_image,
@@ -38,7 +39,7 @@ class CertClientManager:
def remove_client_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 + "client_container_" + log_file_name + ".log", "w")
+ text_file = open(ARCHIVES_PATH + "client_container_" + log_file_name + ".log", "wb")
text_file.write(container.logs())
text_file.close()
container.remove()
diff --git a/tests/oom-platform-cert-service/certservice/libraries/ResponseParser.py b/tests/oom-platform-cert-service/certservice/libraries/ResponseParser.py
index d4de5f28..7ae833cd 100644
--- a/tests/oom-platform-cert-service/certservice/libraries/ResponseParser.py
+++ b/tests/oom-platform-cert-service/certservice/libraries/ResponseParser.py
@@ -1,3 +1,8 @@
+import base64
+
+
def parse_response(response):
- certChain = response["certificateChain"]
- return "".join(certChain).encode("base64").replace("\n", "").strip()
+ cert_chain = response["certificateChain"]
+ encoded_bytes = base64.b64encode(bytes("".join(cert_chain), 'utf-8'))
+ base64_str = encoded_bytes.decode('utf-8')
+ return base64_str.replace("\n", "").strip()
diff --git a/tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot b/tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot
index 755cf989..4bda6198 100644
--- a/tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot
+++ b/tests/oom-platform-cert-service/certservice/resources/cert-service-keywords.robot
@@ -3,7 +3,6 @@
Resource ../../../common.robot
Resource ./cert-service-properties.robot
Library RequestsLibrary
-Library HttpLibrary.HTTP
Library Collections
Library Process
Library DateTime
@@ -12,6 +11,7 @@ Library ../libraries/P12ArtifactsValidator.py ${MOUNT_PATH}
Library ../libraries/JksArtifactsValidator.py ${MOUNT_PATH}
Library ../libraries/PemArtifactsValidator.py ${MOUNT_PATH}
Library ../libraries/ResponseParser.py
+Library json
*** Keywords ***
@@ -30,8 +30,9 @@ Run Healthcheck
Validate Recieved Response
[Documentation] Validare message that has been received
[Arguments] ${resp} ${key} ${expected_value}
- ${json}= Parse Json ${resp.content}
+ ${json}= Evaluate json.loads(r"""${resp.content}""", strict=False) json
${value}= Get From Dictionary ${json} ${key}
+ Log To Console ${value}
Should Be Equal As Strings ${value} ${expected_value}
Send Get Request And Validate Response
@@ -57,7 +58,7 @@ Send Get Request with Header And Expect Success
Check Message Recieved On Success
[Documentation] Check if correct messsage has been sent on successful request
[Arguments] ${content}
- ${resp_content}= Parse Json ${content}
+ ${resp_content}= Evaluate json.loads(r"""${content}""", strict=False) json
Dictionary Should Contain Key ${resp_content} certificateChain
@{list}= Get From Dictionary ${resp_content} certificateChain
List Should Contain Certificates @{list}
@@ -142,7 +143,7 @@ Send Certificate Initialization Request And Return Certificate
[Arguments] ${path} ${csr_file} ${pk_file}
[Return] ${base64Certificate}
${resp}= Send Get Request with Header ${path} ${csr_file} ${pk_file}
- ${json}= Parse Json ${resp.content}
+ ${json}= Evaluate json.loads(r"""${resp.content}""", strict=False) json
${base64Certificate}= Parse Response ${json}
Send Certificate Update Request And Return Response
diff --git a/tests/oom-platform-cert-service/postprocessor/libraries/JksValidator.py b/tests/oom-platform-cert-service/postprocessor/libraries/JksValidator.py
index 983f66bb..c2262a78 100644
--- a/tests/oom-platform-cert-service/postprocessor/libraries/JksValidator.py
+++ b/tests/oom-platform-cert-service/postprocessor/libraries/JksValidator.py
@@ -4,7 +4,8 @@ import jks
class JksValidator:
def get_jks_entries(self, jks_path, password_path):
- store = jks.KeyStore.load(jks_path, open(password_path, 'rb').read())
+ passphrase = open(password_path, 'rb').read().decode("utf-8")
+ store = jks.KeyStore.load(jks_path, passphrase)
return store.entries
def assert_jks_truststores_equal(self, result_truststore_path, password_path, expected_truststore_path):
diff --git a/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py b/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py
index 8dc9623d..3c157514 100644
--- a/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py
+++ b/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py
@@ -16,4 +16,5 @@ class PemTruststoreValidator:
def get_list_of_pem_certificates(self, path):
- return re.findall(BEGIN_CERT + '(.+?)' + END_CERT, open(path, 'rb').read(), re.DOTALL)
+ content = open(path, 'rb').read().decode("utf-8")
+ return re.findall(BEGIN_CERT + '(.+?)' + END_CERT, content, re.DOTALL)
diff --git a/tests/oom-platform-cert-service/postprocessor/libraries/PostProcessorDockerContainerUtils.py b/tests/oom-platform-cert-service/postprocessor/libraries/PostProcessorDockerContainerUtils.py
index e0563b3f..fb5d07c1 100644
--- a/tests/oom-platform-cert-service/postprocessor/libraries/PostProcessorDockerContainerUtils.py
+++ b/tests/oom-platform-cert-service/postprocessor/libraries/PostProcessorDockerContainerUtils.py
@@ -40,7 +40,7 @@ class PostProcessorDockerContainerUtils:
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 + "certservice_postprocessor_container_" + log_file_name + ".log", "w")
+ text_file = open(ARCHIVES_PATH + "certservice_postprocessor_container_" + log_file_name + ".log", "wb")
text_file.write(container.logs())
text_file.close()
container.remove()