Skip to content

Commit

Permalink
TestCI bugfix investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
andsel committed Dec 15, 2023
1 parent 06d6119 commit cad20d4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/temp_maven_build_debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow is copied from maven_build.yml and is temporarily used to throubleshoot failure that appears only in CI

name: Java CI with Maven

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
name: Temp test of CI
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
architecture: x64
- name: Test with Maven
run: ./mvnw -Dtest="SharedSubscriptionTest#givenSharedSubscriptionWithCertainQoSWhenSameClientWithSameShareSubscribeToSameTopicFilterThenQoSUpdates" test -pl broker --file pom.xml

10 changes: 6 additions & 4 deletions broker/src/main/java/io/moquette/broker/MQTTConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ void sendPublish(MqttPublishMessage publishMsg) {
final String topicName = publishMsg.variableHeader().topicName();
MqttQoS qos = publishMsg.fixedHeader().qosLevel();
if (LOG.isTraceEnabled()) {
LOG.trace("Sending PUBLISH({}) message. MessageId={}, topic={}, payload={}", qos, packetId, topicName,
DebugUtils.payload2Str(publishMsg.payload()));
LOG.trace("Sending PUBLISH({}) message. MessageId={}, topic={}, payload={} to {}", qos, packetId, topicName,
DebugUtils.payload2Str(publishMsg.payload()), getClientId());
} else {
LOG.debug("Sending PUBLISH({}) message. MessageId={}, topic={}", qos, packetId, topicName);
LOG.debug("Sending PUBLISH({}) message. MessageId={}, topic={} to {}", qos, packetId, topicName, getClientId());
}
sendIfWritableElseDrop(publishMsg);
}
Expand All @@ -703,7 +703,7 @@ void sendIfWritableElseDrop(MqttMessage msg) {
LOG.debug("OUT {}", msg.fixedHeader().messageType());
}
if (channel.isWritable()) {

LOG.debug("Sending message {} on the wire", msg.fixedHeader().messageType());
// Sending to external, retain a duplicate. Just retain is not
// enough, since the receiver must have full control.
Object retainedDup = msg;
Expand All @@ -718,6 +718,8 @@ void sendIfWritableElseDrop(MqttMessage msg) {
channelFuture = channel.write(retainedDup);
}
channelFuture.addListener(FIRE_EXCEPTION_ON_FAILURE);
} else {
LOG.debug("Dropping message {} on the wire, msg: {}", msg.fixedHeader().messageType(), msg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ private static void verifyPubPayload(MqttMessage received, String expectedPayloa
MqttPublishMessage pub = (MqttPublishMessage) received;
String payload = pub.payload().asByteBuf().toString(StandardCharsets.UTF_8);
assertEquals(expectedPayload, payload);
assertTrue(pub.release(), "received message must be deallocated");
}

@NotNull
Expand Down Expand Up @@ -279,6 +280,8 @@ public void givenSharedSubscriptionWithCertainQoSWhenSameClientWithSameShareSubs
// because the PUB is at QoS1 and the subscription is at QoS0, the subscribed doesn't receive any message
verifyNoPublish(subscriberClient,Duration.ofSeconds(1), "No message is expected at Qos0 subscription");

LOG.info("Before repeating with AT_LEAST_ONCE");

// update QoS for shared subscription
subscribe(subscriberClient, "$share/collectors/metric/temperature/living", MqttQos.AT_LEAST_ONCE);

Expand Down
2 changes: 1 addition & 1 deletion broker/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#log4j.rootLogger=ERROR, stdout, file
log4j.rootLogger=ERROR, stdout

log4j.logger.io.moquette=WARN
log4j.logger.io.moquette=DEBUG
#log4j.logger.io.moquette.broker=DEBUG
#log4j.logger.io.moquette.broker.MQTTConnection=DEBUG
#log4j.logger.io.moquette.broker.SessionRegistry=DEBUG
Expand Down

0 comments on commit cad20d4

Please sign in to comment.