Skip to content

Commit

Permalink
fix: adds integration tests for query options
Browse files Browse the repository at this point in the history
Adds an integration test to run the sql script with several expectations
for the query options. These are tests for the optimizer version and
optimizer statistics package.
  • Loading branch information
thiagotnunes committed Jun 5, 2021
1 parent 3494264 commit 7eda457
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2020 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.connection.it;

import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import com.google.cloud.spanner.connection.SqlScriptVerifier.SpannerGenericConnection;
import org.junit.Before;
import org.junit.Test;

public class ITQueryOptionsTest extends ITAbstractSpannerTest {

private static final String TEST_QUERY_OPTIONS = "ITSqlScriptTest_TestQueryOptions.sql";

private SqlScriptVerifier verifier;

@Before
public void setUp() {
verifier = new SqlScriptVerifier();
}

@Test
public void verifiesQueryOptions() throws Exception {
try (ITConnection connection = createConnection()) {
verifier.verifyStatementsInFile(
SpannerGenericConnection.of(connection), TEST_QUERY_OPTIONS, SqlScriptVerifier.class);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ SET OPTIMIZER_VERSION = 'v1';

-- Optimizer statistics package
@EXPECT EXCEPTION INVALID_ARGUMENT 'INVALID_ARGUMENT: Unknown value for OPTIMIZER_STATISTICS_PACKAGE: ' ''
SET OPTIMIZER_VERSION = ' ';
SET OPTIMIZER_STATISTICS_PACKAGE = ' ';

0 comments on commit 7eda457

Please sign in to comment.