Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: pretty print json payloads and disable robotidy to preserve leading whitespace #3314

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,35 @@ Send device profile operation from Cumulocity IoT
... file=${CURDIR}/tedge-configuration-plugin.toml

${PROFILE_NAME}= Set Variable Test Profile
${PROFILE_PAYLOAD}= Catenate SEPARATOR=\n {
... "firmware": {
... "name":"tedge-core",
... "version":"1.0.0",
... "url":"https://abc.com/some/firmware/url"
... },
... "software":[
... {
... "name":"jq",
... "action":"install",
... "version":"latest",
... "url":""
... },
... {
... "name":"tree",
... "action":"install",
... "version":"latest",
... "url":""
... }
... ],
... "configuration":[
... {
... "name":"tedge-configuration-plugin",
... "type":"tedge-configuration-plugin",
... "url":"${config_url}"
... }
... ]
# robotidy: off
${PROFILE_PAYLOAD}= Catenate SEPARATOR=\n
... {
... "firmware": {
... "name": "tedge-core",
... "version": "1.0.0",
... "url": "https://abc.com/some/firmware/url"
... },
... "software": [
... {
... "name": "jq",
... "action": "install",
... "version": "latest",
... "url": ""
... },
... {
... "name": "tree",
... "action": "install",
... "version": "latest",
... "url": ""
... }
... ],
... "configuration": [
... {
... "name": "tedge-configuration-plugin",
... "type": "tedge-configuration-plugin",
... "url": "${config_url}"
... }
... ]
... }

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

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

# robotidy: off
${payload}= Catenate SEPARATOR=\n
... {
... "status": "init",
... "name": "dev-profile",
... "version": "v2",
... "operations": [
... {
... "operation": "firmware_update",
... "@skip": false,
... "payload": {
... "name": "tedge-core",
... "remoteUrl": "https://abc.com/some/firmware/url",
... "version": "1.0.0"
... }
... },
... {
... "operation": "software_update",
... "@skip": false,
... "payload": {
... "updateList": [
... {
... "type": "apt",
... "modules": [
... {
... "name": "yq",
... "version": "latest",
... "action": "install"
... },
... {
... "name": "jo",
... "version": "latest",
... "action": "install"
... }
... ]
... }
... ]
... }
... },
... {
... "operation": "config_update",
... "@skip": false,
... "payload": {
... "type": "tedge-configuration-plugin",
... "tedgeUrl": "${config_url}",
... "remoteUrl": ""
... }
... },
... {
... "operation": "software_update",
... "@skip": true,
... "payload": {
... "updateList": [
... {
... "type": "apt",
... "modules": [
... {
... "name": "htop",
... "version": "latest",
... "action": "install"
... }
... ]
... }
... ]
... }
... },
... {
... "operation": "restart",
... "skip": false,
... "payload": {}
... },
... {
... "operation": "software_update",
... "@skip": false,
... "payload": {
... "updateList": [
... {
... "type": "apt",
... "modules": [
... {
... "name": "rolldice",
... "version": "latest",
... "action": "install"
... }
... ]
... }
... ]
... }
... }
... ]
... "status": "init",
... "name": "dev-profile",
... "version": "v2",
... "operations": [
... {
... "operation": "firmware_update",
... "@skip": false,
... "payload": {
... "name": "tedge-core",
... "remoteUrl": "https://abc.com/some/firmware/url",
... "version": "1.0.0"
... }
... },
... {
... "operation": "software_update",
... "@skip": false,
... "payload": {
... "updateList": [
... {
... "type": "apt",
... "modules": [
... {
... "name": "yq",
... "version": "latest",
... "action": "install"
... },
... {
... "name": "jo",
... "version": "latest",
... "action": "install"
... }
... ]
... }
... ]
... }
... },
... {
... "operation": "config_update",
... "@skip": false,
... "payload": {
... "type": "tedge-configuration-plugin",
... "tedgeUrl": "${config_url}",
... "remoteUrl": ""
... }
... },
... {
... "operation": "software_update",
... "@skip": true,
... "payload": {
... "updateList": [
... {
... "type": "apt",
... "modules": [
... {
... "name": "htop",
... "version": "latest",
... "action": "install"
... }
... ]
... }
... ]
... }
... },
... {
... "operation": "restart",
... "skip": false,
... "payload": {}
... },
... {
... "operation": "software_update",
... "@skip": false,
... "payload": {
... "updateList": [
... {
... "type": "apt",
... "modules": [
... {
... "name": "rolldice",
... "version": "latest",
... "action": "install"
... }
... ]
... }
... ]
... }
... }
... ]
... }

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