Skip to content

Commit 7fa556f

Browse files
committed
Fix test failure
1 parent 1974819 commit 7fa556f

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

test/test-action-client.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,28 @@ describe('rclnodejs action client', function () {
317317
typeof nativeLoader.actionConfigureFeedbackSubFilterAddGoalId ===
318318
'function';
319319

320+
// Probe whether the RMW actually supports content filtering, matching
321+
// the same check the ActionClient constructor performs.
322+
let isContentFilterSupported = false;
323+
before(function () {
324+
if (isFeedbackFilterSupported()) {
325+
try {
326+
const Fibonacci_ = rclnodejs.require(fibonacci);
327+
const probeSub = node.createSubscription(
328+
Fibonacci_.FeedbackMessage,
329+
'fibonacci/_action/feedback',
330+
() => {}
331+
);
332+
isContentFilterSupported =
333+
typeof probeSub.isContentFilterSupported === 'function' &&
334+
probeSub.isContentFilterSupported();
335+
probeSub.destroy();
336+
} catch {
337+
isContentFilterSupported = false;
338+
}
339+
}
340+
});
341+
320342
it('Test option defaults to false', function () {
321343
let client = new rclnodejs.ActionClient(node, fibonacci, 'fibonacci');
322344
assert.strictEqual(client._enableFeedbackMsgOptimization, false);
@@ -327,8 +349,8 @@ describe('rclnodejs action client', function () {
327349
let client = new rclnodejs.ActionClient(node, fibonacci, 'fibonacci', {
328350
enableFeedbackMsgOptimization: true,
329351
});
330-
// If native API is available, it should be enabled; otherwise disabled
331-
if (isFeedbackFilterSupported()) {
352+
// Only enabled when native API exists AND the RMW supports content filtering
353+
if (isFeedbackFilterSupported() && isContentFilterSupported) {
332354
assert.strictEqual(client._enableFeedbackMsgOptimization, true);
333355
} else {
334356
assert.strictEqual(client._enableFeedbackMsgOptimization, false);

0 commit comments

Comments
 (0)