Skip to content

Commit

Permalink
chore: resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Jun 30, 2020
1 parent eb967c6 commit 2435e88
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 21 deletions.
Expand Up @@ -163,27 +163,6 @@ public void testMultipleSpannersFromSameSpannerOptions() throws InterruptedExcep
assertThat(getNumberOfThreadsWithName(SPANNER_THREAD_NAME)).isAtMost(baseThreadCount);
}

@Test
public void testCompression() {
for (String compressorName : new String[] {"gzip", "identity", null}) {
SpannerOptions options =
env.getTestHelper().getOptions().toBuilder().setCompressorName(compressorName).build();
try (Spanner spanner = options.getService()) {
DatabaseClient client = spanner.getDatabaseClient(db.getId());
try (ResultSet rs =
client
.singleUse()
.executeQuery(Statement.of("SELECT 1 AS COL1 UNION ALL SELECT 2 AS COL2"))) {
assertThat(rs.next()).isTrue();
assertThat(rs.getLong(0)).isEqualTo(1L);
assertThat(rs.next()).isTrue();
assertThat(rs.getLong(0)).isEqualTo(2L);
assertThat(rs.next()).isFalse();
}
}
}
}

private void waitForStartup() throws InterruptedException {
// Wait until the IT environment has already started all base worker threads.
int threadCount;
Expand Down
@@ -0,0 +1,73 @@
/*
* Copyright 2019 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.it;

import static com.google.common.truth.Truth.assertThat;

import com.google.cloud.spanner.Database;
import com.google.cloud.spanner.DatabaseClient;
import com.google.cloud.spanner.IntegrationTestEnv;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Spanner;
import com.google.cloud.spanner.SpannerOptions;
import com.google.cloud.spanner.Statement;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@Category(ParallelIntegrationTest.class)
@RunWith(JUnit4.class)
public class ITSpannerOptionsTest {
@ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv();
private static Database db;

@BeforeClass
public static void setUp() throws Exception {
db = env.getTestHelper().createTestDatabase();
}

@AfterClass
public static void tearDown() throws Exception {
db.drop();
}

@Test
public void testCompression() {
for (String compressorName : new String[] {"gzip", "identity", null}) {
SpannerOptions options =
env.getTestHelper().getOptions().toBuilder().setCompressorName(compressorName).build();
try (Spanner spanner = options.getService()) {
DatabaseClient client = spanner.getDatabaseClient(db.getId());
try (ResultSet rs =
client
.singleUse()
.executeQuery(Statement.of("SELECT 1 AS COL1 UNION ALL SELECT 2 AS COL2"))) {
assertThat(rs.next()).isTrue();
assertThat(rs.getLong(0)).isEqualTo(1L);
assertThat(rs.next()).isTrue();
assertThat(rs.getLong(0)).isEqualTo(2L);
assertThat(rs.next()).isFalse();
}
}
}
}
}

0 comments on commit 2435e88

Please sign in to comment.