Skip to content

Commit 585fac4

Browse files
authored
test: Increased the featurestore tests timeout (GoogleCloudPlatform#7700)
* test: increased the featurestore tests timeout * enabled the featurestore tests * Explicitly set the LRO timeout * Lint reformat
1 parent d11caa1 commit 585fac4

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

aiplatform/src/main/java/aiplatform/CreateFeaturestoreFixedNodesSample.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,21 @@
2424
// [START aiplatform_create_featurestore_fixed_nodes_sample]
2525

2626
import com.google.api.gax.longrunning.OperationFuture;
27+
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
28+
import com.google.api.gax.retrying.RetrySettings;
2729
import com.google.cloud.aiplatform.v1beta1.CreateFeaturestoreOperationMetadata;
2830
import com.google.cloud.aiplatform.v1beta1.CreateFeaturestoreRequest;
2931
import com.google.cloud.aiplatform.v1beta1.Featurestore;
3032
import com.google.cloud.aiplatform.v1beta1.Featurestore.OnlineServingConfig;
3133
import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient;
3234
import com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceSettings;
3335
import com.google.cloud.aiplatform.v1beta1.LocationName;
36+
import com.google.cloud.aiplatform.v1beta1.stub.FeaturestoreServiceStubSettings;
3437
import java.io.IOException;
3538
import java.util.concurrent.ExecutionException;
3639
import java.util.concurrent.TimeUnit;
3740
import java.util.concurrent.TimeoutException;
41+
import org.threeten.bp.Duration;
3842

3943
public class CreateFeaturestoreFixedNodesSample {
4044

@@ -60,8 +64,30 @@ static void createFeaturestoreFixedNodesSample(
6064
int timeout)
6165
throws IOException, InterruptedException, ExecutionException, TimeoutException {
6266

67+
OperationTimedPollAlgorithm operationTimedPollAlgorithm =
68+
OperationTimedPollAlgorithm.create(
69+
RetrySettings.newBuilder()
70+
.setInitialRetryDelay(Duration.ofMillis(5000L))
71+
.setRetryDelayMultiplier(1.5)
72+
.setMaxRetryDelay(Duration.ofMillis(45000L))
73+
.setInitialRpcTimeout(Duration.ZERO)
74+
.setRpcTimeoutMultiplier(1.0)
75+
.setMaxRpcTimeout(Duration.ZERO)
76+
.setTotalTimeout(Duration.ofSeconds(timeout))
77+
.build());
78+
79+
FeaturestoreServiceStubSettings.Builder featurestoreServiceStubSettingsBuilder =
80+
FeaturestoreServiceStubSettings.newBuilder();
81+
82+
featurestoreServiceStubSettingsBuilder
83+
.createFeaturestoreOperationSettings()
84+
.setPollingAlgorithm(operationTimedPollAlgorithm);
85+
FeaturestoreServiceStubSettings featureStoreStubSettings =
86+
featurestoreServiceStubSettingsBuilder.build();
6387
FeaturestoreServiceSettings featurestoreServiceSettings =
64-
FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();
88+
FeaturestoreServiceSettings.create(featureStoreStubSettings);
89+
featurestoreServiceSettings =
90+
featurestoreServiceSettings.toBuilder().setEndpoint(endpoint).build();
6591

6692
// Initialize client that will be used to send requests. This client only needs to be created
6793
// once, and can be reused for multiple requests. After completing all of your requests, call

aiplatform/src/test/java/aiplatform/FeaturestoreSamplesTest.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class FeaturestoreSamplesTest {
4949
private static final boolean USE_FORCE = true;
5050
private static final String LOCATION = "us-central1";
5151
private static final String ENDPOINT = "us-central1-aiplatform.googleapis.com:443";
52-
private static final int TIMEOUT = 900;
52+
private static final int TIMEOUT = 1800;
5353
private ByteArrayOutputStream bout;
5454
private PrintStream out;
5555
private PrintStream originalPrintStream;
@@ -79,13 +79,9 @@ public void setUp() {
7979
public void tearDown()
8080
throws InterruptedException, ExecutionException, IOException, TimeoutException {
8181

82-
try {
83-
// Delete the featurestore
84-
DeleteFeaturestoreSample.deleteFeaturestoreSample(PROJECT_ID, featurestoreId, USE_FORCE,
85-
LOCATION, ENDPOINT, TIMEOUT);
86-
} catch (NullPointerException npe) {
87-
return;
88-
}
82+
// Delete the featurestore
83+
DeleteFeaturestoreSample.deleteFeaturestoreSample(PROJECT_ID, featurestoreId, USE_FORCE,
84+
LOCATION, ENDPOINT, TIMEOUT);
8985

9086
// Assert
9187
String deleteFeaturestoreResponse = bout.toString();
@@ -94,7 +90,6 @@ public void tearDown()
9490
System.setOut(originalPrintStream);
9591
}
9692

97-
@Ignore
9893
@Test
9994
public void testCreateFeaturestoreSample()
10095
throws IOException, InterruptedException, ExecutionException, TimeoutException {

0 commit comments

Comments
 (0)