Skip to content

Commit fb7ff67

Browse files
authored
Merge pull request #3314 from reubenmiller/test-pretty-print-json-payloads
test: pretty print json payloads and disable robotidy to preserve leading whitespace
2 parents 07bf931 + 8a9f7fa commit fb7ff67

File tree

1 file changed

+117
-114
lines changed

1 file changed

+117
-114
lines changed

tests/RobotFramework/tests/tedge_agent/device_profile/device_profile_operation.robot

Lines changed: 117 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,35 @@ Send device profile operation from Cumulocity IoT
2020
... file=${CURDIR}/tedge-configuration-plugin.toml
2121

2222
${PROFILE_NAME}= Set Variable Test Profile
23-
${PROFILE_PAYLOAD}= Catenate SEPARATOR=\n {
24-
... "firmware": {
25-
... "name":"tedge-core",
26-
... "version":"1.0.0",
27-
... "url":"https://abc.com/some/firmware/url"
28-
... },
29-
... "software":[
30-
... {
31-
... "name":"jq",
32-
... "action":"install",
33-
... "version":"latest",
34-
... "url":""
35-
... },
36-
... {
37-
... "name":"tree",
38-
... "action":"install",
39-
... "version":"latest",
40-
... "url":""
41-
... }
42-
... ],
43-
... "configuration":[
44-
... {
45-
... "name":"tedge-configuration-plugin",
46-
... "type":"tedge-configuration-plugin",
47-
... "url":"${config_url}"
48-
... }
49-
... ]
23+
# robotidy: off
24+
${PROFILE_PAYLOAD}= Catenate SEPARATOR=\n
25+
... {
26+
... "firmware": {
27+
... "name": "tedge-core",
28+
... "version": "1.0.0",
29+
... "url": "https://abc.com/some/firmware/url"
30+
... },
31+
... "software": [
32+
... {
33+
... "name": "jq",
34+
... "action": "install",
35+
... "version": "latest",
36+
... "url": ""
37+
... },
38+
... {
39+
... "name": "tree",
40+
... "action": "install",
41+
... "version": "latest",
42+
... "url": ""
43+
... }
44+
... ],
45+
... "configuration": [
46+
... {
47+
... "name": "tedge-configuration-plugin",
48+
... "type": "tedge-configuration-plugin",
49+
... "url": "${config_url}"
50+
... }
51+
... ]
5052
... }
5153

5254
${profile}= Cumulocity.Create Device Profile ${PROFILE_NAME} ${PROFILE_PAYLOAD}
@@ -60,95 +62,96 @@ Send device profile operation locally
6062

6163
Execute Command curl -X PUT --data-binary "bad toml" "${config_url}"
6264

65+
# robotidy: off
6366
${payload}= Catenate SEPARATOR=\n
6467
... {
65-
... "status": "init",
66-
... "name": "dev-profile",
67-
... "version": "v2",
68-
... "operations": [
69-
... {
70-
... "operation": "firmware_update",
71-
... "@skip": false,
72-
... "payload": {
73-
... "name": "tedge-core",
74-
... "remoteUrl": "https://abc.com/some/firmware/url",
75-
... "version": "1.0.0"
76-
... }
77-
... },
78-
... {
79-
... "operation": "software_update",
80-
... "@skip": false,
81-
... "payload": {
82-
... "updateList": [
83-
... {
84-
... "type": "apt",
85-
... "modules": [
86-
... {
87-
... "name": "yq",
88-
... "version": "latest",
89-
... "action": "install"
90-
... },
91-
... {
92-
... "name": "jo",
93-
... "version": "latest",
94-
... "action": "install"
95-
... }
96-
... ]
97-
... }
98-
... ]
99-
... }
100-
... },
101-
... {
102-
... "operation": "config_update",
103-
... "@skip": false,
104-
... "payload": {
105-
... "type": "tedge-configuration-plugin",
106-
... "tedgeUrl": "${config_url}",
107-
... "remoteUrl": ""
108-
... }
109-
... },
110-
... {
111-
... "operation": "software_update",
112-
... "@skip": true,
113-
... "payload": {
114-
... "updateList": [
115-
... {
116-
... "type": "apt",
117-
... "modules": [
118-
... {
119-
... "name": "htop",
120-
... "version": "latest",
121-
... "action": "install"
122-
... }
123-
... ]
124-
... }
125-
... ]
126-
... }
127-
... },
128-
... {
129-
... "operation": "restart",
130-
... "skip": false,
131-
... "payload": {}
132-
... },
133-
... {
134-
... "operation": "software_update",
135-
... "@skip": false,
136-
... "payload": {
137-
... "updateList": [
138-
... {
139-
... "type": "apt",
140-
... "modules": [
141-
... {
142-
... "name": "rolldice",
143-
... "version": "latest",
144-
... "action": "install"
145-
... }
146-
... ]
147-
... }
148-
... ]
149-
... }
150-
... }
151-
... ]
68+
... "status": "init",
69+
... "name": "dev-profile",
70+
... "version": "v2",
71+
... "operations": [
72+
... {
73+
... "operation": "firmware_update",
74+
... "@skip": false,
75+
... "payload": {
76+
... "name": "tedge-core",
77+
... "remoteUrl": "https://abc.com/some/firmware/url",
78+
... "version": "1.0.0"
79+
... }
80+
... },
81+
... {
82+
... "operation": "software_update",
83+
... "@skip": false,
84+
... "payload": {
85+
... "updateList": [
86+
... {
87+
... "type": "apt",
88+
... "modules": [
89+
... {
90+
... "name": "yq",
91+
... "version": "latest",
92+
... "action": "install"
93+
... },
94+
... {
95+
... "name": "jo",
96+
... "version": "latest",
97+
... "action": "install"
98+
... }
99+
... ]
100+
... }
101+
... ]
102+
... }
103+
... },
104+
... {
105+
... "operation": "config_update",
106+
... "@skip": false,
107+
... "payload": {
108+
... "type": "tedge-configuration-plugin",
109+
... "tedgeUrl": "${config_url}",
110+
... "remoteUrl": ""
111+
... }
112+
... },
113+
... {
114+
... "operation": "software_update",
115+
... "@skip": true,
116+
... "payload": {
117+
... "updateList": [
118+
... {
119+
... "type": "apt",
120+
... "modules": [
121+
... {
122+
... "name": "htop",
123+
... "version": "latest",
124+
... "action": "install"
125+
... }
126+
... ]
127+
... }
128+
... ]
129+
... }
130+
... },
131+
... {
132+
... "operation": "restart",
133+
... "skip": false,
134+
... "payload": {}
135+
... },
136+
... {
137+
... "operation": "software_update",
138+
... "@skip": false,
139+
... "payload": {
140+
... "updateList": [
141+
... {
142+
... "type": "apt",
143+
... "modules": [
144+
... {
145+
... "name": "rolldice",
146+
... "version": "latest",
147+
... "action": "install"
148+
... }
149+
... ]
150+
... }
151+
... ]
152+
... }
153+
... }
154+
... ]
152155
... }
153156

154157
Execute Command tedge mqtt pub --retain 'te/device/main///cmd/device_profile/robot-123' '${payload}'

0 commit comments

Comments
 (0)