Skip to content

Commit 6dd0d47

Browse files
authored
fix: fix tests (#112)
There were two issues preventing the tests from running: 1) The tests use the 'latest' image tag for MQ - and watch for a particular message code in the log to recognise when the queue manager is ready. Changes in a recent version of MQ meant that the log output has changed, so the tests were waiting forever for a log message that is no longer output. I've updated the message code to match the current MQ behaviour. 2) Fix for a regression that caused a NullPointerException when the MQSourceTaskIT test cleanup method ran - by renaming the locally-scoped SourceTask variable to use the class-scoped variable that the cleanup depends on. Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
1 parent c06d421 commit 6dd0d47

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/integration/java/com/ibm/eventstreams/connect/mqsource/AbstractJMSContextIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public String getConnectionName() {
106106
private void waitForQueueManagerStartup() throws TimeoutException {
107107
final WaitingConsumer logConsumer = new WaitingConsumer();
108108
mqContainer.followOutput(logConsumer);
109-
logConsumer.waitUntil(logline -> logline.getUtf8String().contains("AMQ5975I"));
109+
logConsumer.waitUntil(logline -> logline.getUtf8String().contains("AMQ5806I"));
110110
}
111111

112112
/**

src/integration/java/com/ibm/eventstreams/connect/mqsource/MQSourceTaskAuthIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void verifyJmsConnClosed() throws Exception {
142142
private void waitForQueueManagerStartup() throws TimeoutException {
143143
final WaitingConsumer logConsumer = new WaitingConsumer();
144144
mqContainer.followOutput(logConsumer);
145-
logConsumer.waitUntil(logline -> logline.getUtf8String().contains("AMQ5975I"));
145+
logConsumer.waitUntil(logline -> logline.getUtf8String().contains("AMQ5806I"));
146146
}
147147

148148
private void putAllMessagesToQueue(final List<MQMessage> messages) throws MQException {

src/integration/java/com/ibm/eventstreams/connect/mqsource/MQSourceTaskIT.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,15 @@ public void verifyMessageBatchGroupCommits() throws Exception {
258258

259259
@Test
260260
public void verifyMessageBatchRollback() throws Exception {
261-
final MQSourceTask newConnectTask = new MQSourceTask();
261+
connectTask = new MQSourceTask();
262262

263263
final Map<String, String> connectorConfigProps = createDefaultConnectorProperties();
264264
connectorConfigProps.put("mq.message.body.jms", "true");
265265
connectorConfigProps.put("mq.record.builder",
266266
"com.ibm.eventstreams.connect.mqsource.builders.DefaultRecordBuilder");
267267
connectorConfigProps.put("mq.batch.size", "10");
268268

269-
newConnectTask.start(connectorConfigProps);
269+
connectTask.start(connectorConfigProps);
270270

271271
// Test overview:
272272
//
@@ -289,19 +289,19 @@ public void verifyMessageBatchRollback() throws Exception {
289289
final List<SourceRecord> kafkaMessages;
290290

291291
// first batch should successfully retrieve messages 01-10
292-
kafkaMessages = newConnectTask.poll();
292+
kafkaMessages = connectTask.poll();
293293
assertEquals(10, kafkaMessages.size());
294-
newConnectTask.commit();
295-
newConnectTask.commit();
294+
connectTask.commit();
295+
connectTask.commit();
296296

297297
// second batch (11-20) should fail because of message 16
298298
final ConnectException exc = assertThrows(ConnectException.class, () -> {
299-
newConnectTask.poll();
299+
connectTask.poll();
300300
});
301301
assertTrue(exc.getMessage().equals("Unsupported JMS message type"));
302302

303303
// there should be 20 messages left on the MQ queue (messages 11-30)
304-
newConnectTask.stop();
304+
connectTask.stop();
305305
final List<Message> remainingMQMessages = getAllMessagesFromQueue(MQ_QUEUE);
306306
assertEquals(20, remainingMQMessages.size());
307307
}

0 commit comments

Comments
 (0)