Skip to content

Commit c8ac772

Browse files
committed
Update lm_device_group.test.ts
1 parent 2c1dd4c commit c8ac772

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

tests/tools/lm_device_group.test.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
generateTestResourceName,
1111
isValidLMId,
1212
retry,
13-
waitForIndexing,
1413
} from '../utils/testHelpers.js';
1514
import {
1615
discoverResources,
@@ -81,24 +80,26 @@ describe('lm_device_group', () => {
8180
});
8281

8382
test('should list device groups with filter', async () => {
84-
// Create a test group first
8583
const testGroup = await createTestDeviceGroup(client, {
8684
parentId: resources.rootDeviceGroupId,
8785
});
8886
createdGroupIds.push(testGroup.id);
8987

90-
// Wait for group to be indexed before filtering
91-
await waitForIndexing();
92-
93-
const result = await client.callTool('lm_device_group', {
94-
operation: 'list',
95-
filter: `name:"${testGroup.name}"`,
96-
});
97-
98-
assertToolSuccess(result);
99-
const data = extractToolData<{ items: Array<{ id: number; name: string }> }>(result);
100-
101-
expect(data.items.some(g => g.id === testGroup.id)).toBe(true);
88+
// Poll until LM's search index reflects the new group
89+
await retry(
90+
async () => {
91+
const result = await client.callTool('lm_device_group', {
92+
operation: 'list',
93+
filter: `name:"${testGroup.name}"`,
94+
});
95+
assertToolSuccess(result);
96+
const data = extractToolData<{ items: Array<{ id: number; name: string }> }>(result);
97+
if (!data.items.some(g => g.id === testGroup.id)) {
98+
throw new Error('device group not yet visible to list/filter');
99+
}
100+
},
101+
{ maxAttempts: 15, delayMs: 2000 }
102+
);
102103
});
103104

104105
test('should list device groups with field selection', async () => {

0 commit comments

Comments
 (0)