Skip to content

Commit

Permalink
chore: privatize invocation id getters (#1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWhitehead committed Apr 12, 2022
1 parent 0cd80e3 commit f300450
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Expand Up @@ -143,7 +143,7 @@ public StorageRetryStrategy getStorageRetryStrategy() {
return StorageRetryStrategy.getDefaultStorageRetryStrategy();
}

public boolean isIncludeInvocationId() {
boolean isIncludeInvocationId() {
return DEFAULT_INCLUDE_INVOCATION_ID;
}
}
Expand Down Expand Up @@ -173,7 +173,7 @@ RetryAlgorithmManager getRetryAlgorithmManager() {
}

/** Returns if Invocation ID is enabled and transmitted through x-goog-api-client header. */
public boolean isIncludeInvocationId() {
boolean isIncludeInvocationId() {
return includeInvocationId;
}

Expand Down
Expand Up @@ -118,9 +118,7 @@ public HttpStorageRpc(StorageOptions options) {
// Open Census initialization
censusHttpModule = new CensusHttpModule(tracer, true);
initializer = censusHttpModule.getHttpRequestInitializer(initializer);
if (options.isIncludeInvocationId()) {
initializer = new InvocationIdInitializer(initializer);
}
initializer = new InvocationIdInitializer(initializer);
batchRequestInitializer = censusHttpModule.getHttpRequestInitializer(null);
storage =
new Storage.Builder(transport, new JacksonFactory(), initializer)
Expand Down
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.storage;

import static com.google.cloud.storage.spi.v1.HttpRpcContextTest.*;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand All @@ -29,6 +28,7 @@
import java.util.Optional;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

public class StorageOptionsTest {
Expand Down Expand Up @@ -88,7 +88,12 @@ public void testDisableInvocationId() {
assertFalse(opts1.isIncludeInvocationId());
}

/**
* Disabled until {@link StorageOptions#isIncludeInvocationId()} and {@link
* StorageOptions.Builder#setIncludeInvocationId(boolean)} are public.
*/
@Test
@Ignore
public void testInvocationIdIsNotPassedThroughWhenDisabled() {
MockLowLevelHttpResponse response =
new MockLowLevelHttpResponse()
Expand Down

0 comments on commit f300450

Please sign in to comment.