feat: Cloudformation + RDS
This commit is contained in:
@@ -215,6 +215,42 @@ describe('AwsLogsAdapter queryLogs', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('AwsLogsAdapter filterLogEvents', () => {
|
||||
test('filters across streams and preserves event identity and pagination', async () => {
|
||||
const {client, calls} = stubClient({
|
||||
FilterLogEventsCommand: () => ({
|
||||
events: [{eventId: 'event-1', logStreamName: 'stream-a', timestamp: 1785260000000, message: 'ERROR failed', ingestionTime: 1785260001000}],
|
||||
nextToken: 'page-2',
|
||||
}),
|
||||
})
|
||||
|
||||
const page = await new AwsLogsAdapter(client).filterLogEvents('/floci/probe', {
|
||||
filterPattern: 'ERROR',
|
||||
logStreamNames: ['stream-a'],
|
||||
startTime: 1000,
|
||||
endTime: 2000,
|
||||
}, {cursor: 'page-1', limit: 25})
|
||||
|
||||
expect(calls[0]).toMatchObject({command: 'FilterLogEventsCommand', input: {
|
||||
logGroupName: '/floci/probe', filterPattern: 'ERROR', logStreamNames: ['stream-a'],
|
||||
startTime: 1000, endTime: 2000, nextToken: 'page-1', limit: 25,
|
||||
}})
|
||||
expect(page).toEqual({
|
||||
items: [{
|
||||
id: 'event-1', collectionId: 'stream-a', timestamp: new Date(1785260000000).toISOString(),
|
||||
body: {message: 'ERROR failed'}, metadata: {ingestionTime: new Date(1785260001000).toISOString()},
|
||||
}],
|
||||
nextCursor: 'page-2',
|
||||
})
|
||||
})
|
||||
|
||||
test('retains a continuation token on an empty page', async () => {
|
||||
const {client} = stubClient({FilterLogEventsCommand: () => ({events: [], nextToken: 'keep-going'})})
|
||||
await expect(new AwsLogsAdapter(client).filterLogEvents('/floci/probe', {}))
|
||||
.resolves.toEqual({items: [], nextCursor: 'keep-going'})
|
||||
})
|
||||
})
|
||||
|
||||
describe('AwsLogsAdapter documents', () => {
|
||||
test('lists log streams as collections, newest activity first', async () => {
|
||||
const {client, calls} = stubClient({
|
||||
|
||||
Reference in New Issue
Block a user