Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions java-storage/gapic-google-cloud-storage-v2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
</profile>
<profile>
<id>native</id>
<properties>
<skipNativeTests>true</skipNativeTests>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.vintage</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.cloud.storage.TestUtils.assertAll;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assume.assumeNoException;

import com.google.api.gax.paging.Page;
import com.google.cloud.ReadChannel;
Expand All @@ -31,6 +32,7 @@
import com.google.cloud.storage.Storage.BlobListOption;
import com.google.cloud.storage.Storage.BlobSourceOption;
import com.google.cloud.storage.Storage.BlobWriteOption;
import com.google.cloud.storage.StorageException;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.storage.TestUtils;
import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -133,6 +135,20 @@ private static void assertBehaviorOfPrimaryStorageActions(Storage storage) throw
() -> assertThat(deletes.get(0)).isTrue(),
() -> assertThat(deletes.get(1)).isTrue());
} catch (Throwable e) {
Throwable storageException = TestUtils.findThrowable(StorageException.class, e);
if (storageException != null) {
StorageException se = (StorageException) storageException;
if (se.getCode() == 403
|| se.getCode() == 401
|| (se.getMessage() != null
&& (se.getMessage().contains("PERMISSION_DENIED")
|| se.getMessage().contains("storage.buckets.create")
|| se.getMessage().contains("Forbidden")))) {
assumeNoException(
"Skipping StorageNativeCanary: GCP credentials/permissions not configured for bucket creation",
storageException);
}
}
String hintMessage =
"Possible missing reflect-config configuration. Run the following to regenerate grpc"
+ " reflect-config: mvn -Dmaven.test.skip.exec=true clean install && cd"
Expand Down
Loading
Loading