aws / ota-for-aws-iot-embedded-sdk

MIT License
60 stars 74 forks source link

FIX: Invalid topic used to publish request for outstanding OTA jobs #483

Closed paulbartell closed 1 year ago

paulbartell commented 1 year ago

FIX: Invalid topic used to publish request for outstanding OTA jobs

Description

From the original poster @imoir:

This looks like a regression in commit https://github.com/aws/ota-for-aws-iot-embedded-sdk/commit/e43672a0881d6aad65df3a61ece5a4e019c3559f, the thing name is not added to the topic parts in function requestJob_Mqtt() in source/ota_mqtt.c.

fix #480

Checklist:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

kstribrnAmzn commented 1 year ago

Can we expand the unit tests to catch this issue in the future?

kstribrnAmzn commented 1 year ago

Test output with the change....

ctest
Test project /home/ubuntu/ota-for-aws-iot-embedded-sdk/build
    Start 1: ota_utest
1/4 Test #1: ota_utest ........................   Passed    0.02 sec
    Start 2: ota_base64_utest
2/4 Test #2: ota_base64_utest .................   Passed    0.00 sec
    Start 3: ota_cbor_utest
3/4 Test #3: ota_cbor_utest ...................   Passed    0.00 sec
    Start 4: ota_os_posix_utest
4/4 Test #4: ota_os_posix_utest ...............   Passed    5.01 sec

100% tests passed, 0 tests failed out of 4

Test failure if I rollback the source change....

ctest
Test project /home/ubuntu/ota-for-aws-iot-embedded-sdk/build
    Start 1: ota_utest
1/4 Test #1: ota_utest ........................***Failed    0.02 sec
    Start 2: ota_base64_utest
2/4 Test #2: ota_base64_utest .................   Passed    0.00 sec
    Start 3: ota_cbor_utest
3/4 Test #3: ota_cbor_utest ...................   Passed    0.00 sec
    Start 4: ota_os_posix_utest
4/4 Test #4: ota_os_posix_utest ...............   Passed    5.01 sec

75% tests passed, 1 tests failed out of 4

Total Test time (real) =   5.03 sec

The following tests FAILED:
      1 - ota_utest (Failed)

The logs show the failed expectation.../home/ubuntu/ota-for-aws-iot-embedded-sdk/test/unit-test/ota_utest.c:490:test_OTA_MQTT_PublishesToCorrectTopic:FAIL: Expected '$aws/things/ota_utest/jobs/$next/get' Was '$aws/things/'