Skip to content

Commit

Permalink
chore(bazel): update protobuf to v3.21.7 (#754)
Browse files Browse the repository at this point in the history
- [ ] 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
  • Loading branch information
gcf-owl-bot[bot] committed Oct 4, 2022
1 parent b34a4ca commit 4f4268d
Show file tree
Hide file tree
Showing 1,299 changed files with 90,575 additions and 130,853 deletions.
4 changes: 2 additions & 2 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ integration)
;;
graalvm)
# Run Unit and Integration Tests with Native Image
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative-0.9.14 -Penable-integration-tests test
RETURN_CODE=$?
;;
graalvm17)
# Run Unit and Integration Tests with Native Image
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative-0.9.14 -Penable-integration-tests test
RETURN_CODE=$?
;;
samples)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public class BaseTest {
protected static final String DEFAULT_PROJECT = ServiceOptions.getDefaultProjectId();
protected static final String DEFAULT_ZONE = "us-central1-a";
protected static final String DEFAULT_REGION = "us-west1";
protected static final String COMPUTE_PREFIX = "gapic-";

public static String generateRandomName(String placeholder) {
return "gapic-" + placeholder + UUID.randomUUID().toString().substring(0, 8);
return COMPUTE_PREFIX + placeholder + UUID.randomUUID().toString().substring(0, 8);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static void setUp() throws IOException {
addresses = new ArrayList<>();
AddressesSettings addressesSettings = AddressesSettings.newBuilder().build();
addressesClient = AddressesClient.create(addressesSettings);
Util.cleanUpComputeAddresses(addressesClient, DEFAULT_PROJECT, DEFAULT_REGION, COMPUTE_PREFIX);
}

@Before
Expand Down Expand Up @@ -122,7 +123,7 @@ private void insertAddress(String description) {
.insertAsync(DEFAULT_PROJECT, DEFAULT_REGION, address)
.get(60, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
fail("Insert operation failed.");
fail("Insert operation failed: " + e.getMessage());
}
addresses.add(address);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public static void setUp() throws IOException {
instances = new ArrayList<>();
InstancesSettings instanceSettings = InstancesSettings.newBuilder().build();
instancesClient = InstancesClient.create(instanceSettings);
Util.cleanUpComputeInstances(instancesClient, DEFAULT_PROJECT, DEFAULT_ZONE, COMPUTE_PREFIX);
}

@Before
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.compute.v1.integration;

import com.google.cloud.compute.v1.Address;
import com.google.cloud.compute.v1.AddressesClient;
import com.google.cloud.compute.v1.DeleteInstanceRequest;
import com.google.cloud.compute.v1.Instance;
import com.google.cloud.compute.v1.InstancesClient;
import com.google.cloud.compute.v1.InstancesClient.ListPagedResponse;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;

public class Util {

// Cleans existing test resources if any.
private static final int DELETION_THRESHOLD_TIME_HOURS = 24;

/** Bring down any instances that are older than 24 hours */
public static void cleanUpComputeInstances(
InstancesClient instancesClient, String project, String zone, String prefix) {
ListPagedResponse listPagedResponse = instancesClient.list(project, zone);
for (Instance instance : listPagedResponse.iterateAll()) {
if (isCreatedBeforeThresholdTime(
ZonedDateTime.parse(instance.getCreationTimestamp()).toInstant())
&& instance.getName().startsWith(prefix)) {
instancesClient.deleteAsync(
DeleteInstanceRequest.newBuilder()
.setInstance(instance.getName())
.setProject(project)
.setZone(zone)
.build());
}
}
}

/** Bring down any addresses that are older than 24 hours */
public static void cleanUpComputeAddresses(
AddressesClient addressesClient, String project, String region, String prefix) {
AddressesClient.ListPagedResponse listPagedResponse = addressesClient.list(project, region);
for (Address address : listPagedResponse.iterateAll()) {
if (isCreatedBeforeThresholdTime(address.getCreationTimestamp())
&& address.getName().startsWith(prefix)) {
addressesClient.deleteAsync(project, region, address.getName());
}
}
}

private static boolean isCreatedBeforeThresholdTime(Instant instant) {
return instant.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_HOURS, ChronoUnit.HOURS));
}

private static boolean isCreatedBeforeThresholdTime(String timestamp) {
return OffsetDateTime.parse(timestamp)
.toInstant()
.isBefore(Instant.now().minus(DELETION_THRESHOLD_TIME_HOURS, ChronoUnit.HOURS));
}
}
4 changes: 3 additions & 1 deletion owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
s.move(library)

s.remove_staging_dirs()
java.common_templates()
java.common_templates(excludes=[
'.kokoro/build.sh'
])
64 changes: 64 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,70 @@
<module>google-cloud-compute-bom</module>
</modules>

<profiles>
<profile>
<id>native-0.9.14</id>

<dependencies>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.9.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>junit-platform-native</artifactId>
<version>0.9.14</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- Must use older version of surefire plugin for native-image testing. -->
<version>2.22.2</version>
<configuration>
<!-- Include all tests during native image testing. -->
<excludes combine.self="override"/>
<includes>
<include>**/IT*.java</include>
<!-- Enable unit tests in generated libraries for native image testing. -->
<include>**/*ClientTest.java</include>
</includes>
</configuration>
</plugin>

<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.14</version>
<extensions>true</extensions>
<executions>
<execution>
<id>test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<buildArgs>
<buildArg>--no-fallback</buildArg>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<reporting>
<plugins>
<plugin>
Expand Down

0 comments on commit 4f4268d

Please sign in to comment.