Skip to content

Commit c3827d3

Browse files
authored
Merge pull request #96 from arduino/update_ci_tests
msic: Update CI tests.
2 parents 5791f0f + 659b673 commit c3827d3

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.github/workflows/client-test.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: '🧪 Test Cloud Client'
22

33
on:
44
push:
5-
branches:
5+
branches:
66
- 'main'
77
paths:
88
- '**.py'
@@ -16,14 +16,17 @@ on:
1616
- edited
1717
- reopened
1818
- synchronize
19-
branches:
19+
branches:
2020
- 'main'
2121
paths:
2222
- '**.py'
2323
- '.github/workflows/*.yml'
2424
- '.github/workflows/*.json'
2525
- '!**/README.md'
2626

27+
schedule:
28+
- cron: '0 12 * * *' # Runs every day at 12 PM UTC
29+
2730
jobs:
2831
build:
2932
runs-on: ubuntu-latest
@@ -89,14 +92,18 @@ jobs:
8992
- name: '☁️ Connect to IoT cloud (CPython / Key-Cert Auth / Async)'
9093
env:
9194
DEVICE_ID: ${{ secrets.DEVICE_ID2 }}
92-
SECRET_KEY: ${{ secrets.SECRET_KEY }}
9395
run: |
9496
python tests/ci.py --file-auth
9597
98+
- name: '☁️ Connect to IoT cloud (CPython / Key-Cert Auth / CADATA / Async)'
99+
env:
100+
DEVICE_ID: ${{ secrets.DEVICE_ID2 }}
101+
run: |
102+
python tests/ci.py --file-auth --ca-data
103+
96104
- name: '☁️ Connect to IoT cloud (CPython / Crypto Auth / Async)'
97105
env:
98106
DEVICE_ID: ${{ secrets.DEVICE_ID2 }}
99-
SECRET_KEY: ${{ secrets.SECRET_KEY }}
100107
run: |
101108
export SOFTHSM2_CONF="${HOME}/softhsm/tokens/softhsm2.conf"
102109
python tests/ci.py --crypto-device
@@ -122,7 +129,6 @@ jobs:
122129
- name: '☁️ Connect to IoT cloud (MicroPython / Key-Cert Auth / Async)'
123130
env:
124131
DEVICE_ID: ${{ secrets.DEVICE_ID2 }}
125-
SECRET_KEY: ${{ secrets.SECRET_KEY }}
126132
run: |
127133
export PATH="${HOME}/cache/bin:${PATH}"
128134
micropython -c "import sys; print(sys.path)"

tests/ci.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import asyncio
99
from arduino_iot_cloud import ArduinoCloudClient
1010
from arduino_iot_cloud import Task
11+
from arduino_iot_cloud import CADATA # noqa
1112
import argparse
1213

1314

@@ -25,7 +26,7 @@ def on_value_changed(client, value):
2526
def wdt_task(client, args, ts=[None]):
2627
if ts[0] is None:
2728
ts[0] = time.time()
28-
if time.time() - ts[0] > 10:
29+
if time.time() - ts[0] > 20:
2930
loop = asyncio.get_event_loop()
3031
loop.set_exception_handler(exception_handler)
3132
logging.error("Timeout waiting for variable")
@@ -47,6 +48,9 @@ def wdt_task(client, args, ts=[None]):
4748
parser.add_argument(
4849
"-f", "--file-auth", action="store_true", help="Use key/cert files"
4950
)
51+
parser.add_argument(
52+
"-ca", "--ca-data", action="store_true", help="Use embedded CADATA"
53+
)
5054
parser.add_argument(
5155
"-s", "--sync", action="store_true", help="Run in synchronous mode"
5256
)
@@ -76,12 +80,14 @@ def wdt_task(client, args, ts=[None]):
7680
elif args.file_auth:
7781
import ssl
7882
fmt = "der" if sys.implementation.name == "micropython" else "pem"
83+
ca_key = "cadata" if args.ca_data else "cafile"
84+
ca_val = CADATA if args.ca_data else f"ca-root.{fmt}"
7985
client = ArduinoCloudClient(
8086
device_id=os.getenv("DEVICE_ID"),
8187
ssl_params={
8288
"keyfile": f"key.{fmt}",
8389
"certfile": f"cert.{fmt}",
84-
"ca_certs": f"ca-root.{fmt}",
90+
ca_key: ca_val,
8591
"cert_reqs": ssl.CERT_REQUIRED,
8692
},
8793
sync_mode=args.sync,
@@ -95,7 +101,7 @@ def wdt_task(client, args, ts=[None]):
95101
"use_hsm": True,
96102
"keyfile": "pkcs11:token=arduino",
97103
"certfile": "pkcs11:token=arduino",
98-
"ca_certs": "ca-root.pem",
104+
"cafile": "ca-root.pem",
99105
"cert_reqs": ssl.CERT_REQUIRED,
100106
"engine_path": "/lib/x86_64-linux-gnu/engines-3/libpkcs11.so",
101107
"module_path": "/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so",

0 commit comments

Comments
 (0)