Skip to content

chore: configure backups test to run in nightly build #1409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 6, 2021
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
12 changes: 12 additions & 0 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ integration)
verify
RETURN_CODE=$?
;;
slowtests)
mvn -B ${INTEGRATION_TEST_ARGS} \
-ntp \
-Pslow-tests \
-DskipITs=false \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-fae \
verify
RETURN_CODE=$?
;;
samples)
SAMPLES_DIR=samples
# only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise.
Expand Down
38 changes: 38 additions & 0 deletions .kokoro/nightly/slow-tests.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Format: //devtools/kokoro/config/proto/build.proto
# Runs the slow tests only in the nightly build

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "slowtests"
}
# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "ENABLE_FLAKYBOT"
value: "true"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}
54 changes: 48 additions & 6 deletions google-cloud-spanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@
</configuration>
<executions>
<execution>
<!-- Executes unit tests -->
<id>default-test</id>
<configuration>
<excludedGroups>com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.IntegrationTest</excludedGroups>
<excludedGroups>com.google.cloud.spanner.categories.TracerTest,com.google.cloud.spanner.categories.IntegrationTest</excludedGroups>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably need to change the package name for TracerTest further below as well (line 62)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, thanks, fixed it.

</configuration>
</execution>
<execution>
Expand All @@ -58,7 +59,7 @@
<goal>test</goal>
</goals>
<configuration>
<groups>com.google.cloud.spanner.TracerTest</groups>
<groups>com.google.cloud.spanner.categories.TracerTest</groups>
</configuration>
</execution>
</executions>
Expand All @@ -76,21 +77,21 @@
<forkedProcessTimeoutInSeconds>3000</forkedProcessTimeoutInSeconds>
</configuration>
<executions>
<!-- Executes serial integration tests -->
<execution>
<id>default</id>
<configuration>
<groups>com.google.cloud.spanner.IntegrationTest</groups>
<excludedGroups>com.google.cloud.spanner.FlakyTest,com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.ParallelIntegrationTest</excludedGroups>
<groups>com.google.cloud.spanner.categories.SerialIntegrationTest</groups>
</configuration>
</execution>
<!-- Executes parallel integration tests -->
<execution>
<id>parallel-integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<groups>com.google.cloud.spanner.ParallelIntegrationTest</groups>
<excludedGroups>com.google.cloud.spanner.FlakyTest,com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.IntegrationTest</excludedGroups>
<groups>com.google.cloud.spanner.categories.ParallelIntegrationTest</groups>
<forkCount>8</forkCount>
<reuseForks>true</reuseForks>
</configuration>
Expand Down Expand Up @@ -365,6 +366,47 @@
</plugins>
</build>
</profile>
<profile>
<id>slow-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<configuration>
<groups>com.google.cloud.spanner.categories.SlowTest</groups>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>default</id>
<configuration>
<groups>com.google.cloud.spanner.categories.SlowTest</groups>
</configuration>
</execution>
<!-- Overrides default configuration to skip this step -->
<execution>
<id>parallel-integration-test</id>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the intention with this execution? The name seems to indicate that it will execute parallel integration tests, but if I understand the configuration correctly, it will just skip all tests. Could we maybe add a comment to this section to explain why it's here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the default configuration (line 88-98) defines an execution for the integration-test goal with such id. Thus, we need to override it in the slow tests profile to NOOP, otherwise the tests with the category ParallelIntegrationTest will be executed (as per the default one). I added a comment in this section.

<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipTests>true</skipTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>spanner-directpath-it</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

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 All @@ -40,7 +41,7 @@
* <p>See also {@code it/WriteIntegrationTest}, which provides coverage of writing and reading back
* all Cloud Spanner types.
*/
@Category(IntegrationTest.class)
@Category(SerialIntegrationTest.class)
@RunWith(JUnit4.class)
public class ITSessionPoolIntegrationTest {
@ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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 All @@ -48,8 +49,8 @@
import org.junit.runners.JUnit4;
import org.threeten.bp.Duration;

@RunWith(JUnit4.class)
@Category(TracerTest.class)
@RunWith(JUnit4.class)
public class SpanTest {
private static final String TEST_PROJECT = "my-project";
private static final String TEST_INSTANCE = "my-instance";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

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

/** Integration Test interface. */
public interface IntegrationTest {}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

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

/** Parallel Integration Test interface. */
public interface ParallelIntegrationTest {}
public interface ParallelIntegrationTest extends IntegrationTest {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Google LLC
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,12 +14,7 @@
* limitations under the License.
*/

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

/**
* 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 {}
/** Serial Integration Test interface. */
public interface SerialIntegrationTest {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2021 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.categories;

/** Category of slow tests, to be run on the nightly build * */
public interface SlowTest extends IntegrationTest {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 Google LLC
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,13 +14,12 @@
* limitations under the License.
*/

package com.google.cloud.spanner;

import org.junit.experimental.categories.Category;
package com.google.cloud.spanner.categories;

/**
* Tests marked with this {@link Category} will be executed in a separate execution with the
* maven-surefire plugin. The tests will be excluded from execution with the maven-failsafe plugin.
* Tests marked with this {@link org.junit.experimental.categories.Category} will be executed in a
* separate execution with the maven-surefire plugin. The tests will be excluded from execution with
* the maven-failsafe plugin.
*
* <p>Separate execution prevents the injection of any custom tracing configuration from interfering
* with other tests, as most tracing configuration is stored in static final variables.
Expand Down
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;

import com.google.cloud.spanner.IntegrationTest;
import com.google.cloud.spanner.ResultSet;
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 All @@ -39,7 +39,7 @@
* parallel with other tests, as it tries to close all active connections, and should not try to
* close connections of other integration tests.
*/
@Category(IntegrationTest.class)
@Category(SerialIntegrationTest.class)
@RunWith(JUnit4.class)
public class ITBulkConnectionTest extends ITAbstractSpannerTest {
private static final int NUMBER_OF_TEST_CONNECTIONS = 250;
Expand Down
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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

import com.google.cloud.spanner.ParallelIntegrationTest;
import com.google.cloud.spanner.categories.ParallelIntegrationTest;
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
import com.google.cloud.spanner.connection.SqlScriptVerifier;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading