Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

Commit 4f4268d

Browse files
chore(bazel): update protobuf to v3.21.7 (#754)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 477955264 Source-Link: https://togithub.com/googleapis/googleapis/commit/a724450af76d0001f23602684c49cd6a4b3a5654 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/4abcbcaec855e74a0b22a4988cf9e0eb61a83094 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGFiY2JjYWVjODU1ZTc0YTBiMjJhNDk4OGNmOWUwZWI2MWE4MzA5NCJ9
1 parent b34a4ca commit 4f4268d

File tree

1,299 files changed

+90575
-130853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,299 files changed

+90575
-130853
lines changed

Diff for: .kokoro/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ integration)
7171
;;
7272
graalvm)
7373
# Run Unit and Integration Tests with Native Image
74-
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test
74+
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative-0.9.14 -Penable-integration-tests test
7575
RETURN_CODE=$?
7676
;;
7777
graalvm17)
7878
# Run Unit and Integration Tests with Native Image
79-
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test
79+
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative-0.9.14 -Penable-integration-tests test
8080
RETURN_CODE=$?
8181
;;
8282
samples)

Diff for: google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/BaseTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ public class BaseTest {
2222
protected static final String DEFAULT_PROJECT = ServiceOptions.getDefaultProjectId();
2323
protected static final String DEFAULT_ZONE = "us-central1-a";
2424
protected static final String DEFAULT_REGION = "us-west1";
25+
protected static final String COMPUTE_PREFIX = "gapic-";
2526

2627
public static String generateRandomName(String placeholder) {
27-
return "gapic-" + placeholder + UUID.randomUUID().toString().substring(0, 8);
28+
return COMPUTE_PREFIX + placeholder + UUID.randomUUID().toString().substring(0, 8);
2829
}
2930
}

Diff for: google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/ITAddressesTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public static void setUp() throws IOException {
4646
addresses = new ArrayList<>();
4747
AddressesSettings addressesSettings = AddressesSettings.newBuilder().build();
4848
addressesClient = AddressesClient.create(addressesSettings);
49+
Util.cleanUpComputeAddresses(addressesClient, DEFAULT_PROJECT, DEFAULT_REGION, COMPUTE_PREFIX);
4950
}
5051

5152
@Before
@@ -122,7 +123,7 @@ private void insertAddress(String description) {
122123
.insertAsync(DEFAULT_PROJECT, DEFAULT_REGION, address)
123124
.get(60, TimeUnit.SECONDS);
124125
} catch (InterruptedException | ExecutionException | TimeoutException e) {
125-
fail("Insert operation failed.");
126+
fail("Insert operation failed: " + e.getMessage());
126127
}
127128
addresses.add(address);
128129
}

Diff for: google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/ITSmokeInstancesTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public static void setUp() throws IOException {
7272
instances = new ArrayList<>();
7373
InstancesSettings instanceSettings = InstancesSettings.newBuilder().build();
7474
instancesClient = InstancesClient.create(instanceSettings);
75+
Util.cleanUpComputeInstances(instancesClient, DEFAULT_PROJECT, DEFAULT_ZONE, COMPUTE_PREFIX);
7576
}
7677

7778
@Before
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.compute.v1.integration;
17+
18+
import com.google.cloud.compute.v1.Address;
19+
import com.google.cloud.compute.v1.AddressesClient;
20+
import com.google.cloud.compute.v1.DeleteInstanceRequest;
21+
import com.google.cloud.compute.v1.Instance;
22+
import com.google.cloud.compute.v1.InstancesClient;
23+
import com.google.cloud.compute.v1.InstancesClient.ListPagedResponse;
24+
import java.time.Instant;
25+
import java.time.OffsetDateTime;
26+
import java.time.ZonedDateTime;
27+
import java.time.temporal.ChronoUnit;
28+
29+
public class Util {
30+
31+
// Cleans existing test resources if any.
32+
private static final int DELETION_THRESHOLD_TIME_HOURS = 24;
33+
34+
/** Bring down any instances that are older than 24 hours */
35+
public static void cleanUpComputeInstances(
36+
InstancesClient instancesClient, String project, String zone, String prefix) {
37+
ListPagedResponse listPagedResponse = instancesClient.list(project, zone);
38+
for (Instance instance : listPagedResponse.iterateAll()) {
39+
if (isCreatedBeforeThresholdTime(
40+
ZonedDateTime.parse(instance.getCreationTimestamp()).toInstant())
41+
&& instance.getName().startsWith(prefix)) {
42+
instancesClient.deleteAsync(
43+
DeleteInstanceRequest.newBuilder()
44+
.setInstance(instance.getName())
45+
.setProject(project)
46+
.setZone(zone)
47+
.build());
48+
}
49+
}
50+
}
51+
52+
/** Bring down any addresses that are older than 24 hours */
53+
public static void cleanUpComputeAddresses(
54+
AddressesClient addressesClient, String project, String region, String prefix) {
55+
AddressesClient.ListPagedResponse listPagedResponse = addressesClient.list(project, region);
56+
for (Address address : listPagedResponse.iterateAll()) {
57+
if (isCreatedBeforeThresholdTime(address.getCreationTimestamp())
58+
&& address.getName().startsWith(prefix)) {
59+
addressesClient.deleteAsync(project, region, address.getName());
60+
}
61+
}
62+
}
63+
64+
private static boolean isCreatedBeforeThresholdTime(Instant instant) {
65+
return instant.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_HOURS, ChronoUnit.HOURS));
66+
}
67+
68+
private static boolean isCreatedBeforeThresholdTime(String timestamp) {
69+
return OffsetDateTime.parse(timestamp)
70+
.toInstant()
71+
.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_HOURS, ChronoUnit.HOURS));
72+
}
73+
}

Diff for: owlbot.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
s.move(library)
2222

2323
s.remove_staging_dirs()
24-
java.common_templates()
24+
java.common_templates(excludes=[
25+
'.kokoro/build.sh'
26+
])

Diff for: pom.xml

+64
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,70 @@
110110
<module>google-cloud-compute-bom</module>
111111
</modules>
112112

113+
<profiles>
114+
<profile>
115+
<id>native-0.9.14</id>
116+
117+
<dependencies>
118+
119+
<dependency>
120+
<groupId>org.junit.vintage</groupId>
121+
<artifactId>junit-vintage-engine</artifactId>
122+
<version>5.9.1</version>
123+
<scope>test</scope>
124+
</dependency>
125+
126+
<dependency>
127+
<groupId>org.graalvm.buildtools</groupId>
128+
<artifactId>junit-platform-native</artifactId>
129+
<version>0.9.14</version>
130+
<scope>test</scope>
131+
</dependency>
132+
</dependencies>
133+
134+
<build>
135+
<plugins>
136+
<plugin>
137+
<groupId>org.apache.maven.plugins</groupId>
138+
<artifactId>maven-surefire-plugin</artifactId>
139+
<!-- Must use older version of surefire plugin for native-image testing. -->
140+
<version>2.22.2</version>
141+
<configuration>
142+
<!-- Include all tests during native image testing. -->
143+
<excludes combine.self="override"/>
144+
<includes>
145+
<include>**/IT*.java</include>
146+
<!-- Enable unit tests in generated libraries for native image testing. -->
147+
<include>**/*ClientTest.java</include>
148+
</includes>
149+
</configuration>
150+
</plugin>
151+
152+
<plugin>
153+
<groupId>org.graalvm.buildtools</groupId>
154+
<artifactId>native-maven-plugin</artifactId>
155+
<version>0.9.14</version>
156+
<extensions>true</extensions>
157+
<executions>
158+
<execution>
159+
<id>test-native</id>
160+
<goals>
161+
<goal>test</goal>
162+
</goals>
163+
<phase>test</phase>
164+
</execution>
165+
</executions>
166+
<configuration>
167+
<buildArgs>
168+
<buildArg>--no-fallback</buildArg>
169+
</buildArgs>
170+
</configuration>
171+
</plugin>
172+
</plugins>
173+
</build>
174+
</profile>
175+
</profiles>
176+
113177
<reporting>
114178
<plugins>
115179
<plugin>

0 commit comments

Comments
 (0)