Skip to content

Commit

Permalink
fix: revert test category refactoring (#1419)
Browse files Browse the repository at this point in the history
Reverts moving the category interfaces of tests to their own package.
This is because we export the tests as a jar to maven and it could break
application code.
  • Loading branch information
thiagotnunes committed Sep 13, 2021
1 parent dc1f9a9 commit fe2ad14
Show file tree
Hide file tree
Showing 47 changed files with 74 additions and 51 deletions.
12 changes: 6 additions & 6 deletions google-cloud-spanner/pom.xml
Expand Up @@ -50,7 +50,7 @@
<!-- Executes unit tests -->
<id>default-test</id>
<configuration>
<excludedGroups>com.google.cloud.spanner.categories.TracerTest,com.google.cloud.spanner.categories.IntegrationTest</excludedGroups>
<excludedGroups>com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.IntegrationTest</excludedGroups>
</configuration>
</execution>
<execution>
Expand All @@ -59,7 +59,7 @@
<goal>test</goal>
</goals>
<configuration>
<groups>com.google.cloud.spanner.categories.TracerTest</groups>
<groups>com.google.cloud.spanner.TracerTest</groups>
</configuration>
</execution>
</executions>
Expand All @@ -81,7 +81,7 @@
<execution>
<id>default</id>
<configuration>
<groups>com.google.cloud.spanner.categories.SerialIntegrationTest</groups>
<groups>com.google.cloud.spanner.SerialIntegrationTest</groups>
</configuration>
</execution>
<!-- Executes parallel integration tests -->
Expand All @@ -91,7 +91,7 @@
<goal>integration-test</goal>
</goals>
<configuration>
<groups>com.google.cloud.spanner.categories.ParallelIntegrationTest</groups>
<groups>com.google.cloud.spanner.ParallelIntegrationTest</groups>
<forkCount>8</forkCount>
<reuseForks>true</reuseForks>
</configuration>
Expand Down Expand Up @@ -377,7 +377,7 @@
<execution>
<id>default-test</id>
<configuration>
<groups>com.google.cloud.spanner.categories.SlowTest</groups>
<groups>com.google.cloud.spanner.SlowTest</groups>
</configuration>
</execution>
</executions>
Expand All @@ -389,7 +389,7 @@
<execution>
<id>default</id>
<configuration>
<groups>com.google.cloud.spanner.categories.SlowTest</groups>
<groups>com.google.cloud.spanner.SlowTest</groups>
</configuration>
</execution>
<!-- Overrides default configuration to skip this step -->
Expand Down
@@ -0,0 +1,25 @@
/*
* Copyright 2017 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;

/**
* Annotation for JUnit {@link org.junit.experimental.categories.Category} that indicates a test is
* flaky. These will be excluded from integration tests. Use this annotation sparingly: typically it
* should only be used for a test where the flakiness is dependent on a fix in a module dependency
* (for example, grpc-java) and cannot be addressed locally.
*/
public interface FlakyTest {}
Expand Up @@ -20,7 +20,6 @@

import com.google.cloud.grpc.GrpcTransportOptions.ExecutorFactory;
import com.google.cloud.spanner.SessionPool.PooledSessionFuture;
import com.google.cloud.spanner.categories.SerialIntegrationTest;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.cloud.spanner.categories;
package com.google.cloud.spanner;

/** Integration Test interface. */
public interface IntegrationTest {}
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.cloud.spanner.categories;
package com.google.cloud.spanner;

/** Parallel Integration Test interface. */
public interface ParallelIntegrationTest extends IntegrationTest {}
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.cloud.spanner.categories;
package com.google.cloud.spanner;

/** Serial Integration Test interface. */
public interface SerialIntegrationTest {}
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.cloud.spanner.categories;
package com.google.cloud.spanner;

/** Category of slow tests, to be run on the nightly build * */
public interface SlowTest extends IntegrationTest {}
Expand Up @@ -25,7 +25,6 @@
import com.google.cloud.NoCredentials;
import com.google.cloud.spanner.MockSpannerServiceImpl.SimulatedExecutionTime;
import com.google.cloud.spanner.MockSpannerServiceImpl.StatementResult;
import com.google.cloud.spanner.categories.TracerTest;
import com.google.protobuf.ListValue;
import com.google.spanner.v1.ResultSetMetadata;
import com.google.spanner.v1.StructType;
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.cloud.spanner.categories;
package com.google.cloud.spanner;

/**
* Tests marked with this {@link org.junit.experimental.categories.Category} will be executed in a
Expand Down
Expand Up @@ -33,11 +33,11 @@
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.Options;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SpannerExceptionFactory;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.Struct;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.Connection;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.TransactionRetryListener;
Expand Down
Expand Up @@ -21,8 +21,8 @@
import static org.hamcrest.MatcherAssert.assertThat;

import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SerialIntegrationTest;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.categories.SerialIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import java.util.ArrayList;
import java.util.List;
Expand Down
Expand Up @@ -25,9 +25,9 @@

import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import org.junit.Before;
import org.junit.Test;
Expand Down
Expand Up @@ -16,7 +16,7 @@

package com.google.cloud.spanner.connection.it;

import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import org.junit.Test;
Expand Down
Expand Up @@ -28,11 +28,11 @@
import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.Options;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ReadContext.QueryAnalyzeMode;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import java.math.BigInteger;
Expand Down
Expand Up @@ -24,11 +24,11 @@

import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SpannerBatchUpdateException;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import java.util.Arrays;
Expand Down
Expand Up @@ -24,9 +24,9 @@

import com.google.cloud.spanner.AbortedDueToConcurrentModificationException;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.AbstractSqlScriptVerifier.GenericConnection;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
Expand Down
Expand Up @@ -19,8 +19,8 @@
import static com.google.cloud.spanner.testing.EmulatorSpannerHelper.isUsingEmulator;

import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import com.google.cloud.spanner.connection.SqlScriptVerifier.SpannerGenericConnection;
Expand Down
Expand Up @@ -25,10 +25,10 @@
import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.Key;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import java.util.Arrays;
Expand Down
Expand Up @@ -27,10 +27,10 @@
import com.google.cloud.spanner.AbortedException;
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.TransactionRetryListener;
import java.sql.Connection;
Expand Down
Expand Up @@ -42,13 +42,13 @@
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.Options;
import com.google.cloud.spanner.SerialIntegrationTest;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.Struct;
import com.google.cloud.spanner.TimestampBound;
import com.google.cloud.spanner.Type;
import com.google.cloud.spanner.Type.StructField;
import com.google.cloud.spanner.categories.SerialIntegrationTest;
import com.google.cloud.spanner.testing.RemoteSpannerHelper;
import com.google.common.util.concurrent.SettableFuture;
import java.util.ArrayList;
Expand Down
Expand Up @@ -34,10 +34,10 @@
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ReadOnlyTransaction;
import com.google.cloud.spanner.SerialIntegrationTest;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.Struct;
import com.google.cloud.spanner.categories.SerialIntegrationTest;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import java.util.ArrayList;
Expand Down
Expand Up @@ -23,12 +23,12 @@
import com.google.cloud.spanner.DatabaseClient;
import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.IntegrationTestEnv;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.SpannerBatchUpdateException;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.TransactionRunner;
import com.google.cloud.spanner.TransactionRunner.TransactionCallable;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import java.util.ArrayList;
import java.util.Collections;
Expand Down
Expand Up @@ -28,12 +28,12 @@
import com.google.cloud.spanner.IntegrationTestEnv;
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.Partition;
import com.google.cloud.spanner.PartitionOptions;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.TimestampBound;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import java.util.ArrayList;
Expand Down
Expand Up @@ -24,6 +24,7 @@
import com.google.cloud.spanner.Database;
import com.google.cloud.spanner.IntegrationTestWithClosedSessionsEnv;
import com.google.cloud.spanner.IntegrationTestWithClosedSessionsEnv.DatabaseClientWithClosedSessionImpl;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ReadOnlyTransaction;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SessionNotFoundException;
Expand All @@ -32,7 +33,6 @@
import com.google.cloud.spanner.TransactionContext;
import com.google.cloud.spanner.TransactionManager;
import com.google.cloud.spanner.TransactionRunner;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down
Expand Up @@ -28,11 +28,11 @@
import com.google.cloud.spanner.Key;
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Struct;
import com.google.cloud.spanner.TimestampBound;
import com.google.cloud.spanner.Value;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ConnectionOptions;
import com.google.cloud.spanner.testing.RemoteSpannerHelper;
import com.google.common.collect.ImmutableList;
Expand Down
Expand Up @@ -28,14 +28,14 @@
import com.google.cloud.spanner.KeyRange;
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.SpannerExceptionFactory;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.TimestampBound;
import com.google.cloud.spanner.TransactionRunner;
import com.google.cloud.spanner.TransactionRunner.TransactionCallable;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import java.util.Collections;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down
Expand Up @@ -31,10 +31,10 @@
import com.google.cloud.spanner.ErrorCode;
import com.google.cloud.spanner.IntegrationTestEnv;
import com.google.cloud.spanner.Options;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.Spanner;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.SpannerOptions;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.testing.RemoteSpannerHelper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
Expand Down
Expand Up @@ -36,12 +36,12 @@
import com.google.cloud.spanner.IntegrationTestEnv;
import com.google.cloud.spanner.KeySet;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.TransactionContext;
import com.google.cloud.spanner.TransactionRunner.TransactionCallable;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import java.math.BigDecimal;
import java.util.ArrayList;
Expand Down
Expand Up @@ -27,9 +27,9 @@
import com.google.cloud.spanner.IntegrationTestEnv;
import com.google.cloud.spanner.Key;
import com.google.cloud.spanner.Mutation;
import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.SpannerOptions;
import com.google.cloud.spanner.TimestampBound;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.testing.RemoteSpannerHelper;
import com.google.common.base.Stopwatch;
import io.grpc.ManagedChannelBuilder;
Expand Down

0 comments on commit fe2ad14

Please sign in to comment.