diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d05ad023a..bfda3e3022 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,4 +68,11 @@ mvn install -DskipUnitTests # To skip all tests mvn install -DskipTests -``` \ No newline at end of file +``` + + +## Native Image Testing +Native Image testing is enabled for tests that follow a particular naming +convention (`IT*` or `*ClientTest`). Unit tests that use Mockito or EasyMock +have been excluded for the time being as they are not compatible with native +image compilation. \ No newline at end of file diff --git a/google-cloud-bigtable-emulator/pom.xml b/google-cloud-bigtable-emulator/pom.xml index bccb3aeaf0..cbf7c840c5 100644 --- a/google-cloud-bigtable-emulator/pom.xml +++ b/google-cloud-bigtable-emulator/pom.xml @@ -106,6 +106,7 @@ com.google.api api-common + com.google.guava guava diff --git a/google-cloud-bigtable-emulator/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/resource-config.json b/google-cloud-bigtable-emulator/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/resource-config.json new file mode 100644 index 0000000000..aa986d630d --- /dev/null +++ b/google-cloud-bigtable-emulator/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/resource-config.json @@ -0,0 +1,21 @@ +{ + "resources":{ + "includes":[ + { + "pattern":"\\Qgcloud/bigtable-linux-x86_64/platform/bigtable-emulator/cbtemulator\\E" + }, + { + "pattern":"\\Qgcloud/bigtable-darwin-x86_64/platform/bigtable-emulator/cbtemulator\\E" + }, + { + "pattern":"\\Qgcloud/bigtable-linux-x86/platform/bigtable-emulator/cbtemulator\\E" + }, + { + "pattern": "\\Qgcloud/bigtable-windows-x86_64/platform/bigtable-emulator/cbtemulator.exe\\E" + }, + { + "pattern":"\\Qgcloud/bigtable-linux-arm/platform/bigtable-emulator/cbtemulator\\E" + } + ]}, + "bundles":[] +} \ No newline at end of file diff --git a/google-cloud-bigtable-emulator/src/test/java/com/google/cloud/bigtable/emulator/v2/BigtableEmulatorRuleTest.java b/google-cloud-bigtable-emulator/src/test/java/com/google/cloud/bigtable/emulator/v2/ITBigtableEmulatorRuleTest.java similarity index 98% rename from google-cloud-bigtable-emulator/src/test/java/com/google/cloud/bigtable/emulator/v2/BigtableEmulatorRuleTest.java rename to google-cloud-bigtable-emulator/src/test/java/com/google/cloud/bigtable/emulator/v2/ITBigtableEmulatorRuleTest.java index f0eb965299..00e2969f80 100644 --- a/google-cloud-bigtable-emulator/src/test/java/com/google/cloud/bigtable/emulator/v2/BigtableEmulatorRuleTest.java +++ b/google-cloud-bigtable-emulator/src/test/java/com/google/cloud/bigtable/emulator/v2/ITBigtableEmulatorRuleTest.java @@ -38,7 +38,7 @@ import org.junit.runners.JUnit4; @RunWith(JUnit4.class) -public class BigtableEmulatorRuleTest { +public class ITBigtableEmulatorRuleTest { @Rule public BigtableEmulatorRule bigtableRule = BigtableEmulatorRule.create(); private BigtableTableAdminBlockingStub tableAdminStub; private BigtableBlockingStub dataStub; diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java similarity index 99% rename from google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTest.java rename to google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java index 8a21f95c1a..7e5d3a8b05 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClientTests.java @@ -81,7 +81,12 @@ import org.mockito.stubbing.Answer; @RunWith(JUnit4.class) -public class BigtableInstanceAdminClientTest { +/** + * Tests for {@link BigtableTableAdminClient}. This test class uses Mockito so it has been + * explicitly excluded from Native Image testing by not following the naming convention of (IT* and + * *ClientTest). + */ +public class BigtableInstanceAdminClientTests { @Rule public MockitoRule mockitoRule = MockitoJUnit.rule().strictness(Strictness.WARN); private static final String PROJECT_ID = "my-project"; diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java similarity index 99% rename from google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java rename to google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java index 6e6b445758..f3d2261869 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java @@ -91,7 +91,12 @@ import org.threeten.bp.Instant; @RunWith(JUnit4.class) -public class BigtableTableAdminClientTest { +/** + * Tests for {@link BigtableTableAdminClient}. This test class uses Mockito so it has been + * explicitly excluded from Native Image testing by not following the naming convention of (IT* and + * *ClientTest). + */ +public class BigtableTableAdminClientTests { @Rule public final MockitoRule mockitoRule = MockitoJUnit.rule(); private static final String PROJECT_ID = "my-project"; diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BigtableDataClientTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BigtableDataClientTests.java similarity index 98% rename from google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BigtableDataClientTest.java rename to google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BigtableDataClientTests.java index 940d632c12..34c9a29d71 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BigtableDataClientTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/BigtableDataClientTests.java @@ -56,7 +56,12 @@ import org.mockito.stubbing.Answer; @RunWith(JUnit4.class) -public class BigtableDataClientTest { +/** + * Tests for {@link BigtableDataClient}. This test class uses Mockito so it has been explicitly + * excluded from Native Image testing by not following the naming convention of (IT* and + * *ClientTest). + */ +public class BigtableDataClientTests { @Rule public MockitoRule mockitoRule = MockitoJUnit.rule().strictness(Strictness.WARN);