Skip to content

Commit

Permalink
Merge pull request #3187 from gligorisaev/mosquitto_bug
Browse files Browse the repository at this point in the history
test: check publishing of telemetry data whilst mapper is down
  • Loading branch information
reubenmiller authored Oct 18, 2024
2 parents 0748986 + cbb889f commit 80f249e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
24 changes: 24 additions & 0 deletions tests/RobotFramework/tests/mqtt/offline_publishing.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*** Settings ***
Resource ../../resources/common.resource
Library ThinEdgeIO
Library Cumulocity

Test Setup Setup Test
Test Teardown Get Logs


*** Test Cases ***
Publish event whilst mapper is down
[Documentation] The mapper should publish the event to the cloud when it comes back online
${event_type}= Get Random Name
Stop Service tedge-mapper-c8y
Execute Command tedge mqtt pub -q 1 te/device/main///e/${event_type} '{"text":"test message"}'
Start Service tedge-mapper-c8y
Cumulocity.Device Should Have Event/s type=${event_type} expected_text=test message


*** Keywords ***
Setup Test
${DEVICE_SN}= Setup
Set Suite Variable $DEVICE_SN
Device Should Exist ${DEVICE_SN}
19 changes: 13 additions & 6 deletions tests/images/debian-systemd/debian-systemd.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@ RUN apt-get -y update \
net-tools \
# json tools (for tests)
jq \
jo
jo \
# mosquitto (default version used by Debian, see below for more details)
mosquitto \
mosquitto-clients

# Note: Avoid using mosquitto 2.0.18 due to a session persistence bug when using `per_listener_settings true
# Only comment out the custom install logic to make it easier to re-enable once the bug is resolved
# See https://github.com/thin-edge/thin-edge.io/issues/3185 for more details
# Install more recent version of mosquitto >= 2.0.18 from debian backports to avoid mosquitto following bugs:
# The mosquitto repo can't be used as it does not included builds for arm64/aarch64 (only amd64 and armhf)
# * https://github.com/eclipse/mosquitto/issues/2604 (2.0.11)
# * https://github.com/eclipse/mosquitto/issues/2634 (2.0.15)
RUN sh -c "echo 'deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/debian-bookworm-backports.list" \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -t bookworm-backports \
mosquitto \
mosquitto-clients
# * https://github.com/eclipse/mosquitto/issues/2618 (2.0.18)
#RUN sh -c "echo 'deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/debian-bookworm-backports.list" \
# && apt-get update \
# && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -t bookworm-backports \
# mosquitto \
# mosquitto-clients

# Remove unnecessary systemd services
RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
Expand Down

0 comments on commit 80f249e

Please sign in to comment.