Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: remove native image tests from required checks (#2584)
* test: backoff and retry for RESOURCE_EXHAUSTED when creating test instance Do a backoff and retry if CreateInstance fails during integration tests. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: correctly unwrap SpannerException * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: back off more and retry more * fix: prevent -1 as sleep value * build: reuse test instance * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * build: try to get native build to pick up instance * build: remove native image tests from required checks * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: ignore creation error * test: use us-central config * fix: fall back to first config for emulator --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
08af671
commit 850435b
Showing
6 changed files
with
129 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
google-cloud-spanner/src/test/java/com/google/cloud/spanner/IntegrationTestEnvTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2023 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 | ||
* | ||
* http://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.spanner; | ||
|
||
import static com.google.cloud.spanner.IntegrationTestEnv.isRetryableResourceExhaustedException; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
@RunWith(JUnit4.class) | ||
public class IntegrationTestEnvTest { | ||
|
||
@Test | ||
public void testIsRetryableResourceExhaustedException() { | ||
assertFalse( | ||
isRetryableResourceExhaustedException( | ||
SpannerExceptionFactory.newSpannerException(ErrorCode.INVALID_ARGUMENT, "test"))); | ||
assertFalse( | ||
isRetryableResourceExhaustedException( | ||
SpannerExceptionFactory.newSpannerException(ErrorCode.RESOURCE_EXHAUSTED, "test"))); | ||
assertTrue( | ||
isRetryableResourceExhaustedException( | ||
SpannerExceptionFactory.newSpannerException( | ||
ErrorCode.RESOURCE_EXHAUSTED, | ||
"Operation with name \"projects/my-project/instances/my-instance/operations/32bb3dccf4243afc\" failed with status = GrpcStatusCode{transportCode=RESOURCE_EXHAUSTED} and message = Project 123 cannot add 1 nodes in region ."))); | ||
assertTrue( | ||
isRetryableResourceExhaustedException( | ||
SpannerExceptionFactory.newSpannerException( | ||
ErrorCode.RESOURCE_EXHAUSTED, | ||
"Operation with name \"projects/my-project/instances/my-instance/operations/32bb3dccf4243afc\" failed with status = GrpcStatusCode{transportCode=RESOURCE_EXHAUSTED} and message = Project 123 cannot add 99 nodes in region ."))); | ||
assertTrue( | ||
isRetryableResourceExhaustedException( | ||
SpannerExceptionFactory.newSpannerException( | ||
ErrorCode.RESOURCE_EXHAUSTED, | ||
"Could not create instance. Quota exceeded for quota metric 'Instance create requests' and limit 'Instance create requests per minute'"))); | ||
} | ||
} |