Skip to content

Commit 2c941f2

Browse files
committed
split up the rest of features from connect into separate suites
Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
1 parent 127844e commit 2c941f2

File tree

15 files changed

+261
-422
lines changed

15 files changed

+261
-422
lines changed

tests/RobotFramework/tests/pkcs11/compatibility.robot

Lines changed: 0 additions & 246 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*** Settings ***
2+
Resource pin_select.resource
3+
Resource ../pkcs11_common.resource
4+
5+
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
6+
7+
8+
*** Variables ***
9+
${TEDGE_P11_SERVER_VERSION} ${EMPTY}
10+
11+
12+
*** Test Cases ***
13+
Can pass PIN in the request using pin-value
14+
Pass PIN in the request using pin-value
15+
16+
Can pass PIN in the request using device.key_pin
17+
Pass PIN in the request using device.key_pin
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*** Settings ***
2+
Resource pin_select.resource
3+
Resource ../pkcs11_common.resource
4+
5+
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
6+
7+
8+
*** Variables ***
9+
${TEDGE_P11_SERVER_VERSION} 1.6.0
10+
11+
12+
*** Test Cases ***
13+
Can pass PIN in the request using pin-value
14+
Pass PIN in the request using pin-value
15+
16+
Can pass PIN in the request using device.key_pin
17+
Pass PIN in the request using device.key_pin
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*** Settings ***
2+
Resource ../pkcs11_common.resource
3+
4+
5+
*** Keywords ***
6+
Pass PIN in the request using pin-value
7+
[Documentation] Tests if the PIN can be changed for the request by assuming current one is correct and setting a
8+
... different one to see if we get an error about pin being incorrect.
9+
10+
${key_uri}= Execute Command tedge config get device.key_uri strip=True ignore_exit_code=True
11+
# FIXME: this breaks if currently set URI already has query attributes, but currently that's not the case (other tests don't set it)
12+
Execute Command cmd=tedge config set device.key_uri "pkcs11:token=tedge;object=tedge?pin-value=incorrect"
13+
Tedge Reconnect Should Fail With The specified PIN is incorrect
14+
15+
[Teardown] Execute Command tedge config set device.key_uri "${key_uri}"
16+
17+
Pass PIN in the request using device.key_pin
18+
Execute Command tedge config set device.key_pin incorrect
19+
Tedge Reconnect Should Fail With The specified PIN is incorrect
20+
21+
[Teardown] Execute Command tedge config unset device.key_pin

tests/RobotFramework/tests/pkcs11/pkcs11_common.resource

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,19 @@ Install tedge-p11-server
145145
${stdout}= Execute Command tedge-p11-server -V strip=True
146146
Should Be Equal ${stdout} tedge-p11-server ${version}
147147
END
148+
149+
tedge-p11-server Setup
150+
[Arguments] ${tedge_p11_server_version}
151+
${DEVICE_SN}= Setup register=${False}
152+
Set Suite Variable ${DEVICE_SN}
153+
154+
# initialize the soft hsm
155+
Execute Command sudo /usr/bin/tedge-init-hsm.sh --type softhsm2 --pin 123456
156+
# tests expect that the device.key_uri is initially unset
157+
Execute Command cmd=tedge config unset device.key_uri
158+
159+
# configure tedge
160+
Set Cumulocity URLs
161+
ThinEdgeIO.Register Device With Cumulocity CA ${DEVICE_SN}
162+
163+
Install tedge-p11-server ${tedge_p11_server_version}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*** Settings ***
2+
Resource tedge_cert_download.resource
3+
Resource ../pkcs11_common.resource
4+
5+
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
6+
7+
8+
*** Variables ***
9+
${TEDGE_P11_SERVER_VERSION} ${EMPTY}
10+
11+
12+
*** Test Cases ***
13+
Can use tedge cert download c8y to download a certificate
14+
Use tedge cert download c8y to download a certificate
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*** Settings ***
2+
Resource tedge_cert_download.resource
3+
Resource ../pkcs11_common.resource
4+
5+
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
6+
7+
8+
*** Variables ***
9+
${TEDGE_P11_SERVER_VERSION} 1.6.0
10+
11+
12+
*** Test Cases ***
13+
Can use tedge cert download c8y to download a certificate
14+
Use tedge cert download c8y to download a certificate
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*** Settings ***
2+
Resource ../pkcs11_common.resource
3+
4+
5+
*** Keywords ***
6+
Use tedge cert download c8y to download a certificate
7+
[Documentation] Download a certificate using CSR generated with PKCS11 without a prior certificate.
8+
# this new keypair doesn't have an associated certificate
9+
Set up new PKCS11 ECDSA keypair
10+
11+
${credentials}= Cumulocity.Bulk Register Device With Cumulocity CA external_id=${DEVICE_SN}
12+
Execute Command
13+
... cmd=tedge cert download c8y --device-id "${DEVICE_SN}" --one-time-password '${credentials.one_time_password}' --retry-every 5s --max-timeout 60s
14+
15+
Tedge Reconnect Should Succeed

0 commit comments

Comments
 (0)