mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(autoscaling): validate monitoring booleans (#3219)
This commit is contained in:
1 parent
9e9b0b6e91
commit
84a7ce67e4
2 files changed
+19
-2
No files matched your search
+2
-2
@@ -1405,7 +1405,7 @@ public class AutoScalingQueryHandler {
|
||||
private Boolean nullableBoolParam(MultivaluedMap<String, String> p, String key) {
|
||||
String val = p.getFirst(key);
|
||||
if (val == null || val.isBlank()) { return null; }
|
||||
return Boolean.parseBoolean(val);
|
||||
return parseOptionalBoolean(val, key);
|
||||
}
|
||||
|
||||
private List<LaunchConfigurationBlockDeviceMapping> parseLaunchConfigurationBlockDeviceMappings(
|
||||
@@ -1516,7 +1516,7 @@ public class AutoScalingQueryHandler {
|
||||
"1 validation error detected: Value '" + val + "' at '" + key
|
||||
+ "' failed to satisfy constraint: Member must be a valid boolean", 400);
|
||||
}
|
||||
return Boolean.parseBoolean(val);
|
||||
return parseOptionalBoolean(val, key);
|
||||
}
|
||||
|
||||
private String intString(Integer value) {
|
||||
|
||||
+17
@@ -134,6 +134,23 @@ class AutoScalingIntegrationTest {
|
||||
|
||||
@Test
|
||||
@Order(44)
|
||||
void launchConfigurationRejectsInvalidInstanceMonitoringBoolean() {
|
||||
given()
|
||||
.formParam("Action", "CreateLaunchConfiguration")
|
||||
.formParam("LaunchConfigurationName", "my-lc-invalid-monitoring")
|
||||
.formParam("ImageId", "ami-12345678")
|
||||
.formParam("InstanceType", "t3.micro")
|
||||
.formParam("InstanceMonitoring.Enabled", "not-a-boolean")
|
||||
.header("Authorization", AUTH)
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("ValidationError"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(45)
|
||||
void launchConfigurationRejectsAMappingWithoutADeviceName() {
|
||||
given()
|
||||
.formParam("Action", "CreateLaunchConfiguration")
|
||||
|
||||
Reference in new issue
Block a user