Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .kokoro/presubmit/bigtable-integration.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env_vars: {

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-P bigtable-prod-it,enable-verbose-grpc-logs -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests"
value: "-P bigtable-prod-it,enable-verbose-grpc-logs -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests -Dbigtable.expected-protocol=CLASSIC"
}

env_vars: {
Expand Down
3 changes: 3 additions & 0 deletions java-bigtable/google-cloud-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<bigtable.directpath-admin-endpoint/>
<bigtable.internal.client-config-override-use-default>false</bigtable.internal.client-config-override-use-default>
<bigtable.internal.client-config-override/>
<bigtable.expected-protocol/>

<!-- Number of JVMs used to run the integration tests concurrently. The ITs are almost entirely
RPC bound, so this can be raised well above the core count. Override on the commandline via
Expand Down Expand Up @@ -615,6 +616,7 @@
<properties>
<bigtable.internal.client-config-override-use-default>true</bigtable.internal.client-config-override-use-default>
<bigtable.internal.client-config-override>session_configuration { session_diversion_configuration { global_diversion { session_load: 1.0 } } }</bigtable.internal.client-config-override>
<bigtable.expected-protocol>SESSION</bigtable.expected-protocol>
</properties>
</profile>

Expand Down Expand Up @@ -819,6 +821,7 @@
<java.util.logging.config.file>${java-log-config}</java.util.logging.config.file>
<bigtable.internal.client-config-override-use-default>${bigtable.internal.client-config-override-use-default}</bigtable.internal.client-config-override-use-default>
<bigtable.internal.client-config-override>${bigtable.internal.client-config-override}</bigtable.internal.client-config-override>
<bigtable.expected-protocol>${bigtable.expected-protocol}</bigtable.expected-protocol>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public ClientConfigurationManager(
Boolean.parseBoolean(sysProps.getProperty(OVERRIDE_USE_DEFAULT_SYS_PROP_KEY));
this.overrideConfig =
Optional.ofNullable(sysProps.getProperty(OVERRIDE_SYS_PROP_KEY))
.filter(str -> !str.trim().isEmpty())
.map(
str -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,35 @@ void testSysPropOverride() throws Exception {
verify(mockExecutor, times(1)).schedule(any(Runnable.class), anyLong(), any(TimeUnit.class));
}

@Test
void testBlankSysPropOverrideIsIgnoredAndPollsServer() throws Exception {
for (String blankValue : new String[] {"", " \t\n "}) {
for (boolean useDefault : new boolean[] {false, true}) {
manager.close();
service.requestCount.set(0);

Properties sysProps = new Properties();
sysProps.setProperty(ClientConfigurationManager.OVERRIDE_SYS_PROP_KEY, blankValue);
if (useDefault) {
sysProps.setProperty(
ClientConfigurationManager.OVERRIDE_USE_DEFAULT_SYS_PROP_KEY, "true");
}
manager =
new ClientConfigurationManager(
sysProps,
FEATURE_FLAGS,
CLIENT_INFO,
channelProvider,
noopDebugTracer,
mockExecutor);

ClientConfiguration serverConfig = manager.start().get();
assertThat(serverConfig).isEqualTo(service.config.get());
assertThat(service.requestCount.get()).isEqualTo(1);
}
}
}

@Test
void testPerScopeDiversionWithNonZeroLoadEnablesSessions() throws Exception {
ClientConfiguration resolvedConfig =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.google.cloud.bigtable.data.v2.models.TableId;
import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStub;
import com.google.cloud.bigtable.test_helpers.env.AbstractTestEnv.ConnectionMode;
import com.google.cloud.bigtable.test_helpers.env.AbstractTestEnv.ExpectedProtocol;
import com.google.cloud.bigtable.test_helpers.env.CloudEnv;
import com.google.cloud.bigtable.test_helpers.env.PrefixGenerator;
import com.google.cloud.bigtable.test_helpers.env.TestEnvRule;
Expand Down Expand Up @@ -59,10 +60,9 @@
* Verifies that the Bigtable client routes traffic through the session path when sessions are
* enabled.
*
* <p>This test runs when the {@code bigtable-session-it} Maven profile is active (composed with
* {@code bigtable-cfe-it}, {@code bigtable-directpath-it}, or {@code bigtable-prod-it}), which sets
* {@code bigtable.internal.client-config-override} to force {@code global_diversion { session_load:
* 1.0 }}.
* <p>This test runs when {@code -Dbigtable.expected-protocol=SESSION} is set (for example via the
* {@code bigtable-session-it} Maven profile composed with {@code bigtable-cfe-it}, {@code
* bigtable-directpath-it}, or {@code bigtable-prod-it}).
*
* <p>Session path activity is verified by observing:
*
Expand Down Expand Up @@ -96,10 +96,10 @@ public class SessionIT {
public void setUp() throws IOException {
assume()
.withMessage(
"SessionIT requires the session path to be enabled. "
+ "Run with the bigtable-session-it Maven profile.")
.that(testEnvRule.env().isSessionsEnabled())
.isTrue();
"SessionIT requires -Dbigtable.expected-protocol=SESSION "
+ "(set automatically by the bigtable-session-it Maven profile).")
.that(testEnvRule.env().getExpectedProtocol())
.isEqualTo(ExpectedProtocol.SESSION);

assume()
.withMessage("SessionIT requires a cloud environment, not the emulator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.Nullable;

/**
* Defines the interface of a target environment.
Expand All @@ -46,6 +48,12 @@ public enum ConnectionMode {
REQUIRE_DIRECT_PATH_IPV4
}

public enum ExpectedProtocol {
ANY,
CLASSIC,
SESSION
}

abstract void start() throws Exception;

abstract void stop() throws Exception;
Expand Down Expand Up @@ -127,6 +135,17 @@ public ConnectionMode getConnectionMode() {
return ConnectionMode.valueOf(modeStr);
}

public ExpectedProtocol getExpectedProtocol() {
return parseExpectedProtocol(System.getProperty("bigtable.expected-protocol"));
}

static ExpectedProtocol parseExpectedProtocol(@Nullable String protocolStr) {
if (protocolStr == null || protocolStr.trim().isEmpty()) {
return ExpectedProtocol.ANY;
}
return ExpectedProtocol.valueOf(protocolStr.trim().toUpperCase(Locale.US));
}
Comment thread
igorbernstein2 marked this conversation as resolved.
Resolved

public boolean shouldWaitForCmekKeyStatusUpdate() {
return Boolean.getBoolean("bigtable.wait-for-cmek-key-status");
}
Expand Down
Loading
Loading