Skip to content

Commit ae1d04d

Browse files
Merge pull request #4946 from agullon/patch-12
[release-4.19] USHIFT-5775: TLS config RF test: skip cipher if not available
2 parents 4a45b60 + ff15226 commit ae1d04d

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

test/suites/standard2/configuration.robot

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,20 @@ CSI Snapshot Controller Is Deployed
280280

281281
Openssl Connect Command
282282
[Documentation] Run Openssl Connect Command in the remote server
283-
[Arguments] ${host_and_port} ${args}
283+
[Arguments] ${host_and_port} ${args} ${expected_rc} ${expected_str}
284284
${stdout} ${rc}= Execute Command
285285
... openssl s_client -connect ${host_and_port} ${args} <<< "Q"
286286
... sudo=True return_stdout=True return_stderr=False return_rc=True
287-
RETURN ${stdout} ${rc}
287+
Should Be Equal As Integers ${rc} ${expected_rc}
288+
IF "${rc}" == "0" Should Contain ${stdout} ${expected_str}
288289

289290
Check TLS Endpoints
290291
[Documentation] Run Openssl Connect Command to check k8s internal endpoints
291292
[Arguments] ${return_code} ${tls_version} ${cipher}
293+
294+
${cipher_available}= Is Cipher Available ${cipher}
295+
IF ${cipher_available} == ${FALSE} RETURN
296+
292297
IF "${tls_version}" == "TLSv1.2"
293298
Set Test Variable ${TLS_AND_CIPHER_ARGS} -tls1_2 -cipher ${cipher}
294299
ELSE IF "${tls_version}" == "TLSv1.3"
@@ -297,15 +302,25 @@ Check TLS Endpoints
297302

298303
# api server, kubelet, kube controller manager and kube scheduler endpoint ports
299304
FOR ${port} IN 6443 10250 10257 10259
300-
${stdout} ${rc}= Openssl Connect Command ${USHIFT_HOST}:${port} ${TLS_AND_CIPHER_ARGS}
301-
Should Be Equal As Integers ${return_code} ${rc}
302-
IF "${rc}" == "0"
303-
Should Contain ${stdout} ${tls_version}, Cipher is ${cipher}
304-
END
305+
${stdout}= Wait Until Keyword Succeeds 10x 10s
306+
... Openssl Connect Command localhost:${port}
307+
... ${TLS_AND_CIPHER_ARGS}
308+
... ${return_code}
309+
... ${tls_version}, Cipher is ${cipher}
305310
END
306311

307312
# etcd endpoint, need to use cert and key because etcd requires mTLS
308313
Set Test Variable ${CERT_ARG} -cert ${APISERVER_ETCD_CLIENT_CERT}/client.crt
309314
Set Test Variable ${KEY_ARG} -key ${APISERVER_ETCD_CLIENT_CERT}/client.key
310-
${stdout} ${rc}= Openssl Connect Command localhost:2379 ${TLS_AND_CIPHER_ARGS} ${CERT_ARG} ${KEY_ARG}
311-
Should Be Equal As Integers ${return_code} ${rc}
315+
Wait Until Keyword Succeeds 10x 2s
316+
... Openssl Connect Command localhost:2379
317+
... ${TLS_AND_CIPHER_ARGS} ${CERT_ARG} ${KEY_ARG}
318+
... ${return_code}
319+
... CONNECTED
320+
321+
Is Cipher Available
322+
[Documentation] Check if openssl keywork is available from ssl list
323+
[Arguments] ${cipher}
324+
${stdout} ${stderr} ${rc}= Execute Command openssl ciphers ${cipher}
325+
... sudo=True return_stdout=True return_stderr=True return_rc=True
326+
IF "${rc}" == "0" RETURN ${TRUE} ELSE RETURN ${FALSE}

0 commit comments

Comments
 (0)