Skip to content

Commit 1027778

Browse files
committed
add test to check compatibility with tedge-p11-server 1.6.1
Signed-off-by: reubenmiller <[email protected]>
1 parent 7689e03 commit 1027778

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
*** Settings ***
2+
Documentation This test suite runs the tests with tedge-p11-server pinned to a fixed version to ensure that new
3+
... versions of thin-edge remain backwards compatible with tedge-p11-server's binary communication protocol. The
4+
... scope of this test is limited to tedge-p11-server's initial feature set and will generally not be expanded.
5+
6+
Resource pkcs11_common.resource
7+
8+
Suite Setup Custom Setup
9+
Suite Teardown Get Suite Logs
10+
11+
Test Tags adapter:docker theme:cryptoki compatibility
12+
13+
14+
*** Variables ***
15+
${TEDGE_P11_SERVER_VERSION} 1.6.1
16+
17+
18+
*** Test Cases ***
19+
# the test cases are basically copy-pasted from private_key_storage.robot, as the purpose of this suite is to run the
20+
# exact same tests with a slightly different setup. It would be easiest if we could import the test cases themselves
21+
# from another test suite, but this isn't possible. So we extract reusable keywords into a resource file, but test cases
22+
# remain duplicated.
23+
Use Private Key in SoftHSM2 using tedge-p11-server
24+
Tedge Reconnect Should Succeed
25+
26+
Renew certificate
27+
Execute Command tedge cert renew c8y
28+
Tedge Reconnect Should Succeed
29+
30+
*** Keywords ***
31+
Custom Setup
32+
${DEVICE_SN}= Setup register=${False}
33+
Set Suite Variable ${DEVICE_SN}
34+
35+
# this doesn't install anything but adds cloudsmith repo to apt
36+
Execute Command curl -1sLf 'https://dl.cloudsmith.io/public/thinedge/tedge-main/setup.deb.sh' | sudo -E bash
37+
Execute Command cmd=apt-get install -y --allow-downgrades tedge-p11-server=${TEDGE_P11_SERVER_VERSION}
38+
${stdout}= Execute Command tedge-p11-server -V strip=True
39+
Should Be Equal ${stdout} tedge-p11-server ${TEDGE_P11_SERVER_VERSION}
40+
41+
# Allow the tedge user to access softhsm
42+
Execute Command sudo usermod -a -G softhsm tedge
43+
Transfer To Device ${CURDIR}/data/init_softhsm.sh /usr/bin/
44+
45+
# initialize the soft hsm and create a certificate signing request
46+
Execute Command tedge config set device.cryptoki.pin 123456
47+
Execute Command tedge config set device.cryptoki.module_path /usr/lib/softhsm/libsofthsm2.so
48+
Execute Command sudo -u tedge /usr/bin/init_softhsm.sh --device-id "${DEVICE_SN}" --pin 123456
49+
50+
# configure tedge
51+
${domain}= Cumulocity.Get Domain
52+
Execute Command tedge config set c8y.url "${domain}"
53+
Execute Command tedge config set mqtt.bridge.built_in true
54+
Execute Command tedge config set device.cryptoki.mode socket
55+
56+
${csr_path}= Execute Command cmd=tedge config get device.csr_path strip=${True}
57+
Register Device With Cumulocity CA ${DEVICE_SN} csr_path=${csr_path}
58+
59+
Unset tedge-p11-server Uri

0 commit comments

Comments
 (0)