Skip to content

Commit

Permalink
test: add test to ensure journaling BWS errors early for http (#2475)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWhitehead committed Apr 11, 2024
1 parent 0dc9b9e commit 5007e8f
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.cloud.storage.DataGenerator;
import com.google.cloud.storage.GrpcStorageOptions;
import com.google.cloud.storage.HttpStorageOptions;
import com.google.cloud.storage.JournalingBlobWriteSessionConfig;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.Storage.BlobWriteOption;
import com.google.cloud.storage.StorageException;
Expand All @@ -37,9 +38,11 @@
import com.google.cloud.storage.it.runner.annotations.CrossRun;
import com.google.cloud.storage.it.runner.annotations.Inject;
import com.google.cloud.storage.it.runner.registry.Generator;
import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;
import java.nio.file.Path;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
Expand Down Expand Up @@ -91,6 +94,22 @@ public void bufferToTempDirThenUpload() throws Exception {
}
}

@Test
@CrossRun.Exclude(transports = Transport.GRPC)
public void journalingNotSupportedByHttp() {
HttpStorageOptions.Builder builder = ((HttpStorageOptions) storage.getOptions()).toBuilder();

Path rootPath = temporaryFolder.getRoot().toPath();
JournalingBlobWriteSessionConfig journaling =
BlobWriteSessionConfigs.journaling(ImmutableList.of(rootPath));

IllegalArgumentException iae =
assertThrows(
IllegalArgumentException.class, () -> builder.setBlobWriteSessionConfig(journaling));

assertThat(iae).hasMessageThat().contains("HTTP transport");
}

@Test
public void overrideDefaultBufferSize() throws Exception {
StorageOptions options = null;
Expand Down

0 comments on commit 5007e8f

Please sign in to comment.