Skip to content

Commit 6cb5851

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

File tree

10 files changed

+28
-40
lines changed

10 files changed

+28
-40
lines changed

tests/RobotFramework/tests/pkcs11/pin_select/current.robot

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
*** Settings ***
22
Resource pin_select.resource
3-
Resource ../pkcs11_common.resource
4-
53
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
64

75

tests/RobotFramework/tests/pkcs11/pin_select/initial.robot

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
*** Settings ***
22
Resource pin_select.resource
3-
Resource ../pkcs11_common.resource
4-
53
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
64

75

86
*** Variables ***
9-
${TEDGE_P11_SERVER_VERSION} 1.6.0
7+
${TEDGE_P11_SERVER_VERSION} 1.7.0
108

119

1210
*** Test Cases ***

tests/RobotFramework/tests/pkcs11/pin_select/pin_select.resource

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ Pass PIN in the request using pin-value
1212
Execute Command cmd=tedge config set device.key_uri "pkcs11:token=tedge;object=tedge?pin-value=incorrect"
1313
Tedge Reconnect Should Fail With The specified PIN is incorrect
1414

15-
[Teardown] Execute Command tedge config set device.key_uri "${key_uri}"
15+
[Teardown] Restore previous key_uri ${key_uri}
1616

1717
Pass PIN in the request using device.key_pin
1818
Execute Command tedge config set device.key_pin incorrect
1919
Tedge Reconnect Should Fail With The specified PIN is incorrect
2020

2121
[Teardown] Execute Command tedge config unset device.key_pin
22+
23+
Restore previous key_uri
24+
[Arguments] ${key_uri}
25+
IF $key_uri
26+
Execute Command tedge config set device.key_uri "${key_uri}"
27+
ELSE
28+
Execute Command tedge config unset device.key_uri
29+
END

tests/RobotFramework/tests/pkcs11/pkcs11_common.resource

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,19 @@ tedge-p11-server Setup
151151
${DEVICE_SN}= Setup register=${False}
152152
Set Suite Variable ${DEVICE_SN}
153153

154-
# initialize the soft hsm
155-
Execute Command sudo /usr/bin/tedge-init-hsm.sh --type softhsm2 --pin 123456
154+
# Allow the tedge user to access softhsm
155+
Execute Command sudo usermod -a -G softhsm tedge
156+
Transfer To Device ${CURDIR}/data/init_softhsm.sh /usr/bin/
157+
Execute Command sudo -u tedge /usr/bin/init_softhsm.sh --device-id "${DEVICE_SN}" --pin 123456
158+
159+
Execute Command tedge config set device.cryptoki.pin 123456
160+
Execute Command tedge config set device.cryptoki.module_path /usr/lib/softhsm/libsofthsm2.so
161+
Execute Command tedge config set mqtt.bridge.built_in true
162+
Execute Command tedge config set device.cryptoki.mode socket
163+
156164
# tests expect that the device.key_uri is initially unset
157165
Execute Command cmd=tedge config unset device.key_uri
158166

159-
# configure tedge
160167
Set Cumulocity URLs
161168
ThinEdgeIO.Register Device With Cumulocity CA ${DEVICE_SN}
162169

tests/RobotFramework/tests/pkcs11/tedge_cert_download/current.robot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
*** Settings ***
22
Resource tedge_cert_download.resource
3-
Resource ../pkcs11_common.resource
43

54
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
65

tests/RobotFramework/tests/pkcs11/tedge_cert_download/initial.robot

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
*** Settings ***
22
Resource tedge_cert_download.resource
3-
Resource ../pkcs11_common.resource
4-
53
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
64

75

86
*** Variables ***
9-
${TEDGE_P11_SERVER_VERSION} 1.6.0
7+
${TEDGE_P11_SERVER_VERSION} 1.7.0
8+
${PKCS11_USE_P11TOOL} ${True}
109

1110

1211
*** Test Cases ***

tests/RobotFramework/tests/pkcs11/tedge_cert_renew/current.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Documentation This test suite runs the tests with tedge-p11-server pinned
66
Resource ../pkcs11_common.resource
77
Resource tedge_cert_renew.resource
88

9-
Suite Setup Custom Setup ${TEDGE_P11_SERVER_VERSION}
9+
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
1010
Suite Teardown Get Suite Logs
1111

1212
Test Tags adapter:docker theme:cryptoki compatibility

tests/RobotFramework/tests/pkcs11/tedge_cert_renew/initial.robot

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ Documentation This test suite runs the tests with tedge-p11-server pinned
33
... versions of thin-edge remain backwards compatible with tedge-p11-server's binary communication protocol. The
44
... scope of this test is limited to tedge-p11-server's initial feature set and will generally not be expanded.
55
6-
Resource ../pkcs11_common.resource
76
Resource tedge_cert_renew.resource
87

9-
Suite Setup Custom Setup ${TEDGE_P11_SERVER_VERSION}
8+
Suite Setup tedge-p11-server Setup ${TEDGE_P11_SERVER_VERSION}
109
Suite Teardown Get Suite Logs
1110

1211
Test Tags adapter:docker theme:cryptoki compatibility
1312

1413

1514
*** Variables ***
1615
${TEDGE_P11_SERVER_VERSION} 1.6.1
16+
${PKCS11_USE_P11TOOL} ${True}
1717

1818

1919
*** Test Cases ***
@@ -24,4 +24,6 @@ Renew certificate
2424
Use PKCS11 key to renew the public certificate error=PKCS #11 service failed: Failed to find a signing key
2525

2626
Can renew the certificate using different keypair
27+
# In 1.6.1 there was a bug where the generated CSR signature was invalid (#3737), fixed in 1.7.0
28+
Install tedge-p11-server 1.7.0
2729
Renew the certificate using different keypair

tests/RobotFramework/tests/pkcs11/tedge_cert_renew/tedge_cert_renew.resource

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,3 @@ Renew the certificate using different keypair
6666
Execute Command tedge cert renew c8y
6767
${stdout}= Tedge Reconnect Should Succeed
6868
Should Contain ${stdout} The new certificate is now the active certificate
69-
70-
Custom Setup
71-
[Arguments] ${tedge_p11_server_version}
72-
${DEVICE_SN}= Setup register=${False}
73-
Set Suite Variable ${DEVICE_SN}
74-
75-
# Allow the tedge user to access softhsm
76-
Execute Command sudo usermod -a -G softhsm tedge
77-
Transfer To Device ${CURDIR}/data/init_softhsm.sh /usr/bin/
78-
79-
# initialize the soft hsm and create a certificate signing request
80-
Execute Command tedge config set device.cryptoki.pin 123456
81-
Execute Command tedge config set device.cryptoki.module_path /usr/lib/softhsm/libsofthsm2.so
82-
Execute Command sudo -u tedge /usr/bin/init_softhsm.sh --device-id "${DEVICE_SN}" --pin 123456
83-
84-
# configure tedge
85-
Set Cumulocity URLs
86-
Execute Command tedge config set mqtt.bridge.built_in true
87-
Execute Command tedge config set device.cryptoki.mode socket
88-
89-
${csr_path}= Execute Command cmd=tedge config get device.csr_path strip=${True}
90-
Register Device With Cumulocity CA ${DEVICE_SN} csr_path=${csr_path}
91-
92-
Install tedge-p11-server ${tedge_p11_server_version}

tests/RobotFramework/tests/pkcs11/tedge_connect/initial.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ Can connect to C8y using an RSA key
3737
Connects to C8y using an RSA key
3838

3939
Can connect to C8y supporting all TLS13 ECDSA signature algorithms
40+
Install tedge-p11-server 1.6.0
4041
Connects to C8y supporting all TLS13 ECDSA signature algorithms

0 commit comments

Comments
 (0)