fix(logs): refuse FilterLogEvents requests that name no log group (#6693)

This commit is contained in:
Jackson Price authored and GitHub committed 2026-10-26 19:56:51 -04:00
1 parent 45d4c28e33
commit 322a6a0977
5 files changed
+84 -3

No files matched your search

@@ -85,6 +85,17 @@ class CloudWatchLogsFilterPatternTest {
}
}
@Test
@DisplayName("a request naming no log group is refused with InvalidParameterException")
void aRequestNamingNoLogGroupIsRefused() {
// Not measured on AWS: the API reference requires logGroupName or logGroupIdentifier and models
// InvalidParameterException for a parameter specified incorrectly.
try (CloudWatchLogsClient logs = TestFixtures.cloudWatchLogsClient()) {
assertThatThrownBy(() -> logs.filterLogEvents(request -> request.filterPattern("ERROR")))
.isInstanceOf(InvalidParameterException.class);
}
}
/** The 1-based positions in {@link #EVENTS} of the events the pattern matches, oldest first. */
private static List<Integer> matches(CloudWatchLogsClient logs, String groupName, String pattern) {
List<Integer> positions = new ArrayList<>();