Skip to content

Commit

Permalink
ci(spanner): improve performance of samples tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sakthivelmanii committed Dec 16, 2024
1 parent 331942f commit 1e021ea
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions samples/install-without-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<forkCount>10</forkCount>
<reuseForks>false</reuseForks>
<systemPropertyVariables>
<spanner.test.instance>java-sample-integration-tests</spanner.test.instance>
<spanner.test.instance.mr>java-client-mr-integration-tests</spanner.test.instance.mr>
Expand All @@ -157,6 +159,7 @@
<spanner.sample.database>mysample</spanner.sample.database>
<spanner.quickstart.database>quick-db</spanner.quickstart.database>
</systemPropertyVariables>
<excludedGroups>com.example.spanner.helper.SlowTest</excludedGroups>
</configuration>
</plugin>
</plugins>
Expand Down
3 changes: 3 additions & 0 deletions samples/snapshot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<forkCount>10</forkCount>
<reuseForks>false</reuseForks>
<systemPropertyVariables>
<spanner.test.instance>java-sample-integration-tests</spanner.test.instance>
<spanner.test.instance.mr>java-client-mr-integration-tests</spanner.test.instance.mr>
Expand All @@ -157,6 +159,7 @@
<spanner.sample.instance>mysample-instance</spanner.sample.instance>
<spanner.quickstart.database>quick-db</spanner.quickstart.database>
</systemPropertyVariables>
<excludedGroups>com.example.spanner.helper.SlowTest</excludedGroups>
</configuration>
</plugin>
</plugins>
Expand Down
3 changes: 3 additions & 0 deletions samples/snippets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<forkCount>10</forkCount>
<reuseForks>false</reuseForks>
<systemPropertyVariables>
<spanner.test.instance>java-sample-integration-tests</spanner.test.instance>
<spanner.test.instance.mr>java-client-mr-integration-tests</spanner.test.instance.mr>
Expand All @@ -187,6 +189,7 @@
<spanner.sample.database>mysample</spanner.sample.database>
<spanner.quickstart.database>quick-db</spanner.quickstart.database>
</systemPropertyVariables>
<excludedGroups>com.example.spanner.helper.SlowTest</excludedGroups>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.example.spanner.helper;

/* Interface for slow tests */
public interface SlowTest { }
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertTrue;

import com.example.spanner.helper.SlowTest;
import com.google.cloud.Timestamp;
import com.google.cloud.spanner.DatabaseId;
import com.google.cloud.spanner.ErrorCode;
Expand Down Expand Up @@ -51,12 +52,14 @@
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@code SpannerSample} */
@RunWith(JUnit4.class)
@SuppressWarnings("checkstyle:abbreviationaswordinname")
@Category(SlowTest.class)
public class SpannerSampleIT extends SampleTestBaseV2 {

private static final int DBID_LENGTH = 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.junit.Assert.assertTrue;

import com.example.spanner.SampleRunner;
import com.example.spanner.helper.SlowTest;
import com.google.cloud.Timestamp;
import com.google.cloud.spanner.Backup;
import com.google.cloud.spanner.BackupId;
Expand Down Expand Up @@ -48,6 +49,7 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.threeten.bp.LocalDate;
Expand All @@ -56,6 +58,7 @@
/** Unit tests for {@code SpannerSample} */
@RunWith(JUnit4.class)
@SuppressWarnings("checkstyle:abbreviationaswordinname")
@Category(SlowTest.class)
public class SpannerSampleIT {
private static final int DBID_LENGTH = 20;
// The instance needs to exist for tests to pass.
Expand Down

0 comments on commit 1e021ea

Please sign in to comment.