Skip to content

Commit cb46f0c

Browse files
authored
test: update aiplatform FeatureStore timeout + add retries (GoogleCloudPlatform#7540)
* test: doubled delete featurestore timeout * add retries * update another timeout * use timeout constant * use same value of TIMEOUT
1 parent cd80d48 commit cb46f0c

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

aiplatform/src/test/java/aiplatform/FeatureValuesSamplesTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.cloud.bigquery.Dataset;
2828
import com.google.cloud.bigquery.DatasetId;
2929
import com.google.cloud.bigquery.DatasetInfo;
30+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
3031
import java.io.ByteArrayOutputStream;
3132
import java.io.IOException;
3233
import java.io.PrintStream;
@@ -40,12 +41,15 @@
4041
import org.junit.After;
4142
import org.junit.Before;
4243
import org.junit.BeforeClass;
44+
import org.junit.Rule;
4345
import org.junit.Test;
4446
import org.junit.runner.RunWith;
4547
import org.junit.runners.JUnit4;
4648

49+
4750
@RunWith(JUnit4.class)
4851
public class FeatureValuesSamplesTest {
52+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
4953

5054
private static final String PROJECT_ID = System.getenv("UCAIP_PROJECT_ID");
5155
private static final int MIN_NODE_COUNT = 1;
@@ -150,7 +154,7 @@ public void tearDown()
150154

151155
// Delete the featurestore
152156
DeleteFeaturestoreSample.deleteFeaturestoreSample(
153-
PROJECT_ID, featurestoreId, USE_FORCE, LOCATION, ENDPOINT, 300);
157+
PROJECT_ID, featurestoreId, USE_FORCE, LOCATION, ENDPOINT, TIMEOUT);
154158

155159
// Assert
156160
String deleteFeaturestoreResponse = bout.toString();
@@ -174,7 +178,7 @@ public void testFeatureValuesSamples()
174178
String tempUuid = UUID.randomUUID().toString().replaceAll("-", "_").substring(0, 23);
175179
String id = String.format("temp_feature_values_samples_test_%s", tempUuid);
176180
CreateFeaturestoreSample.createFeaturestoreSample(
177-
PROJECT_ID, id, MIN_NODE_COUNT, MAX_NODE_COUNT, LOCATION, ENDPOINT, 900);
181+
PROJECT_ID, id, MIN_NODE_COUNT, MAX_NODE_COUNT, LOCATION, ENDPOINT, TIMEOUT);
178182

179183
// Assert
180184
String createFeaturestoreResponse = bout.toString();
@@ -186,7 +190,7 @@ public void testFeatureValuesSamples()
186190
// Create the entity type
187191
String entityTypeId = "movies";
188192
CreateEntityTypeSample.createEntityTypeSample(
189-
PROJECT_ID, featurestoreId, entityTypeId, DESCRIPTION, LOCATION, ENDPOINT, 900);
193+
PROJECT_ID, featurestoreId, entityTypeId, DESCRIPTION, LOCATION, ENDPOINT, TIMEOUT);
190194

191195
// Assert
192196
String createEntityTypeResponse = bout.toString();
@@ -204,7 +208,7 @@ public void testFeatureValuesSamples()
204208
VALUE_TYPE,
205209
LOCATION,
206210
ENDPOINT,
207-
900);
211+
TIMEOUT);
208212

209213
// Assert
210214
String createFeatureResponse = bout.toString();
@@ -250,7 +254,7 @@ public void testFeatureValuesSamples()
250254

251255
// Delete the feature
252256
DeleteFeatureSample.deleteFeatureSample(
253-
PROJECT_ID, featurestoreId, entityTypeId, featureId, LOCATION, ENDPOINT, 300);
257+
PROJECT_ID, featurestoreId, entityTypeId, featureId, LOCATION, ENDPOINT, TIMEOUT);
254258

255259
// Assert
256260
String deleteFeatureResponse = bout.toString();

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.common.truth.Truth.assertThat;
2020
import static junit.framework.TestCase.assertNotNull;
2121

22+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2223
import java.io.ByteArrayOutputStream;
2324
import java.io.IOException;
2425
import java.io.PrintStream;
@@ -28,12 +29,15 @@
2829
import org.junit.After;
2930
import org.junit.Before;
3031
import org.junit.BeforeClass;
32+
import org.junit.Rule;
3133
import org.junit.Test;
3234
import org.junit.runner.RunWith;
3335
import org.junit.runners.JUnit4;
3436

37+
3538
@RunWith(JUnit4.class)
3639
public class FeaturestoreSamplesTest {
40+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
3741

3842
private static final String PROJECT_ID = System.getenv("UCAIP_PROJECT_ID");
3943
private static final int MIN_NODE_COUNT = 1;
@@ -76,7 +80,7 @@ public void tearDown()
7680

7781
// Delete the featurestore
7882
DeleteFeaturestoreSample.deleteFeaturestoreSample(
79-
PROJECT_ID, featurestoreId, USE_FORCE, LOCATION, ENDPOINT, 60);
83+
PROJECT_ID, featurestoreId, USE_FORCE, LOCATION, ENDPOINT, TIMEOUT);
8084

8185
// Assert
8286
String deleteFeaturestoreResponse = bout.toString();
@@ -92,7 +96,7 @@ public void testCreateFeaturestoreSample()
9296
String tempUuid = UUID.randomUUID().toString().replaceAll("-", "_").substring(0, 25);
9397
String id = String.format("temp_featurestore_samples_test_%s", tempUuid);
9498
CreateFeaturestoreFixedNodesSample.createFeaturestoreFixedNodesSample(
95-
PROJECT_ID, id, FIXED_NODE_COUNT, LOCATION, ENDPOINT, 900);
99+
PROJECT_ID, id, FIXED_NODE_COUNT, LOCATION, ENDPOINT, TIMEOUT);
96100

97101
// Assert
98102
String createFeaturestoreResponse = bout.toString();

0 commit comments

Comments
 (0)