Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Commit 8b3b535

Browse files
committed
refactor(gce): check if acceleratorConfig is not null
1 parent ed87704 commit 8b3b535

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clouddriver-google/src/main/java/com/netflix/spinnaker/clouddriver/google/deploy/handlers/BasicGoogleDeployHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,8 @@ private void setupMonikerForOperation(
738738

739739
protected void validateAcceleratorConfig(BasicGoogleDeployDescription description) {
740740
// Accelerators are supported for zonal server groups only.
741-
if (!description.getAcceleratorConfigs().isEmpty()
741+
if (description.getAcceleratorConfigs() != null
742+
&& !description.getAcceleratorConfigs().isEmpty()
742743
&& (!description.getRegional() || description.getSelectZones())) {
743744
throw new IllegalArgumentException(
744745
"Accelerators are only supported with regional server groups if the zones are specified by the user.");

clouddriver-google/src/test/java/com/netflix/spinnaker/clouddriver/google/deploy/handlers/BasicGoogleDeployHandlerTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,12 @@ void validateAcceleratorConfig_noExceptionForValidConfig() {
11721172
assertDoesNotThrow(() -> basicGoogleDeployHandler.validateAcceleratorConfig(mockDescription));
11731173
}
11741174

1175+
@Test
1176+
void validateAcceleratorConfig_noExceptionForNullConfig() {
1177+
when(mockDescription.getAcceleratorConfigs()).thenReturn(null);
1178+
assertDoesNotThrow(() -> basicGoogleDeployHandler.validateAcceleratorConfig(mockDescription));
1179+
}
1180+
11751181
@Test
11761182
void validateAcceleratorConfig_validRegionalWithZones() {
11771183
BasicGoogleDeployDescription description = mock(BasicGoogleDeployDescription.class);

0 commit comments

Comments
 (0)