Skip to content

Commit

Permalink
fix(test): retry ITSmokeInstancesTest (googleapis#8662)
Browse files Browse the repository at this point in the history
Fixes googleapis#8651
Added retry settings to ITSmokeInstancesTest.testCapitalLetterField to
handle "resourceNotReady" errors.
  • Loading branch information
diegomarquezp committed Oct 22, 2022
1 parent d8aeb2c commit 6b41967
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.cloud.compute.v1.AttachedDiskInitializeParams;
import com.google.cloud.compute.v1.Firewall;
import com.google.cloud.compute.v1.FirewallsClient;
import com.google.cloud.compute.v1.FirewallsSettings;
import com.google.cloud.compute.v1.GetInstanceRequest;
import com.google.cloud.compute.v1.Instance;
import com.google.cloud.compute.v1.InstanceGroupManager;
Expand Down Expand Up @@ -233,7 +234,20 @@ public void testCapitalLetterField()
throws IOException, ExecutionException, InterruptedException {
// we want to test a field like "IPProtocol"
String name = generateRandomName("fw-rule");
FirewallsClient firewallsClient = FirewallsClient.create();
FirewallsSettings.Builder firewallsSettingsBuilder = FirewallsSettings.newBuilder();
firewallsSettingsBuilder
.getSettings()
.setRetrySettings(
firewallsSettingsBuilder
.getSettings()
.getRetrySettings()
.toBuilder()
.setMaxAttempts(5)
.setInitialRetryDelay(org.threeten.bp.Duration.ofSeconds(5))
.setRetryDelayMultiplier(1.0)
.build());
FirewallsSettings firewallsSettings = firewallsSettingsBuilder.build();
FirewallsClient firewallsClient = FirewallsClient.create(firewallsSettings);
Firewall firewall =
Firewall.newBuilder()
.setName(name)
Expand Down

0 comments on commit 6b41967

Please sign in to comment.