mirror of
https://github.com/floci-io/floci.git
synced 2026-12-06 03:28:18 -05:00
fix(ec2): align catalog image owner filtering (#3463)
* fix(ec2): align catalog image owner filtering * fix(ec2): preserve catalog aliases in image filters * test(ec2): pin supported image owner selectors
This commit is contained in:
1 parent
505b5d286e
commit
a6f1751dfb
2 files changed
+38
-1
No files matched your search
@@ -577,6 +577,39 @@ class Ec2ServiceTest {
|
||||
assertTrue(resolved.systemd());
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeImagesUsesOnlyAwsSupportedOwnerSelectorsForCatalogImages() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
|
||||
List<Image> amazon = service.describeImages(
|
||||
"us-east-1", List.of(), List.of("amazon"), Map.of());
|
||||
assertTrue(amazon.stream().anyMatch(image -> "amazon".equals(image.getImageOwnerAlias())));
|
||||
|
||||
List<Image> unsupportedAlias = service.describeImages(
|
||||
"us-east-1", List.of(), List.of("canonical"), Map.of());
|
||||
assertTrue(unsupportedAlias.isEmpty(),
|
||||
"catalog imageOwnerAlias values must not turn arbitrary owner strings into Owners selectors");
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeImagesMatchesCatalogAliasInImageIdFilter() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
Ec2Service service = new Ec2Service(mockConfig(true), mock(Ec2ContainerManager.class),
|
||||
mock(Ec2PortForwardManager.class),
|
||||
new AmiImageResolver(imageCatalog), imageCatalog, new Ec2InstanceTypeCatalog(),
|
||||
new InMemoryStorageFactory());
|
||||
|
||||
List<Image> images = service.describeImages(
|
||||
"us-east-1", List.of(), List.of(), Map.of("image-id", List.of("ami-amazonlinux2")));
|
||||
|
||||
assertEquals(1, images.size());
|
||||
assertEquals("ami-0abcdef1234567890", images.getFirst().getImageId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeImagesResolvesUnknownLaunchableAmiId() {
|
||||
Ec2ImageCatalog imageCatalog = new Ec2ImageCatalog();
|
||||
|
||||
Reference in new issue
Block a user