mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 16:11:48 -05:00
feat(servicequotas): configure applied EC2 vCPU quota (#5926)
* feat(servicequotas): configure applied EC2 vCPU quota Report configured EC2 vCPU quotas separately from AWS defaults. * fix(servicequotas): reject negative applied quota settings Reject invalid quota settings before serving local requests. * docs(servicequotas): clarify negative quota settings * fix(servicequotas): reject invalid settings at startup
This commit is contained in:
1 parent
8298779ead
commit
1a80884f40
11 files changed
+288
-32
No files matched your search
+8
-2
@@ -1,5 +1,6 @@
|
||||
package com.floci.test;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import software.amazon.awssdk.services.servicequotas.ServiceQuotasClient;
|
||||
import software.amazon.awssdk.services.servicequotas.model.ServiceQuota;
|
||||
@@ -20,6 +21,7 @@ class ServiceQuotasTest {
|
||||
ServiceQuota quota = client.getAWSDefaultServiceQuota(request -> request
|
||||
.serviceCode("ec2").quotaCode(STANDARD_CODE)).quota();
|
||||
assertStandardMetadata(quota);
|
||||
assertThat(quota.value()).isEqualTo(5.0);
|
||||
List<List<ServiceQuota>> pages = client.listAWSDefaultServiceQuotasPaginator(request -> request
|
||||
.serviceCode("ec2").maxResults(1)).stream().map(page -> page.quotas()).toList();
|
||||
assertCatalogPages(pages, quota);
|
||||
@@ -27,12 +29,17 @@ class ServiceQuotasTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void emulatedAppliedQuotaReportsTheStaticDefault() {
|
||||
@DisplayName("Applied EC2 quota reads and pagination use the configured value")
|
||||
void emulatedAppliedQuotaReportsConfiguredValue() {
|
||||
assumeFalse(TestFixtures.isRealAws(), "Real applied quotas can differ from catalog defaults");
|
||||
try (ServiceQuotasClient client = TestFixtures.serviceQuotasClient()) {
|
||||
ServiceQuota quota = client.getServiceQuota(request -> request
|
||||
.serviceCode("ec2").quotaCode(STANDARD_CODE)).quota();
|
||||
assertStandardMetadata(quota);
|
||||
assertThat(quota.value()).isNotNull().isGreaterThanOrEqualTo(0.0);
|
||||
String expectedValue = System.getenv().getOrDefault(
|
||||
"FLOCI_TEST_EXPECTED_STANDARD_ON_DEMAND_VCPUS", "5");
|
||||
assertThat(quota.value()).isEqualTo(Double.parseDouble(expectedValue));
|
||||
List<List<ServiceQuota>> pages = client.listServiceQuotasPaginator(request -> request
|
||||
.serviceCode("ec2").maxResults(1)).stream().map(page -> page.quotas()).toList();
|
||||
assertCatalogPages(pages, quota);
|
||||
@@ -53,7 +60,6 @@ class ServiceQuotasTest {
|
||||
assertThat(quota.quotaCode()).isEqualTo(STANDARD_CODE);
|
||||
assertThat(quota.quotaName())
|
||||
.isEqualTo("Running On-Demand Standard (A, C, D, H, I, M, R, T, Z) instances");
|
||||
assertThat(quota.value()).isEqualTo(5.0);
|
||||
assertThat(quota.adjustable()).isTrue();
|
||||
assertThat(quota.globalQuota()).isFalse();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user