21
21
import static org .junit .Assert .assertNotNull ;
22
22
import static org .junit .Assert .assertThrows ;
23
23
import static org .junit .Assume .assumeFalse ;
24
+ import static org .junit .Assume .assumeTrue ;
24
25
25
26
import com .google .cloud .ByteArray ;
26
27
import com .google .cloud .spanner .Database ;
54
55
import org .junit .AfterClass ;
55
56
import org .junit .BeforeClass ;
56
57
import org .junit .ClassRule ;
57
- import org .junit .Ignore ;
58
58
import org .junit .Test ;
59
59
import org .junit .experimental .categories .Category ;
60
60
import org .junit .runner .RunWith ;
61
61
import org .junit .runners .JUnit4 ;
62
62
63
63
// Integration Tests to test DDL, DML and DQL for Proto Columns and Enums
64
- @ Ignore ("Feature is not yet enabled in production" )
65
64
@ Category (ParallelIntegrationTest .class )
66
65
@ RunWith (JUnit4 .class )
67
66
public class ITProtoColumnTest {
@@ -71,10 +70,17 @@ public class ITProtoColumnTest {
71
70
private static DatabaseAdminClient dbAdminClient ;
72
71
private static DatabaseClient databaseClient ;
73
72
73
+ public static boolean isUsingAllowlistedProject () {
74
+ String projectId = System .getProperty ("spanner.gce.config.project_id" , "" );
75
+ return projectId .equalsIgnoreCase ("gcloud-devel" )
76
+ || projectId .equalsIgnoreCase ("span-cloud-testing" );
77
+ }
78
+
74
79
@ BeforeClass
75
80
public static void setUpDatabase () throws Exception {
76
81
assumeFalse (
77
82
"Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
83
+ assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
78
84
RemoteSpannerHelper testHelper = env .getTestHelper ();
79
85
databaseID = DatabaseId .of (testHelper .getInstanceId (), testHelper .getUniqueDatabaseId ());
80
86
dbAdminClient = testHelper .getClient ().getDatabaseAdminClient ();
@@ -133,7 +139,7 @@ public static void createDatabase() throws Exception {
133
139
@ AfterClass
134
140
public static void afterClass () throws Exception {
135
141
try {
136
- if (!isUsingEmulator ()) {
142
+ if (!isUsingEmulator () && isUsingAllowlistedProject () ) {
137
143
dbAdminClient .dropDatabase (
138
144
databaseID .getInstanceId ().getInstance (), databaseID .getDatabase ());
139
145
}
@@ -163,6 +169,7 @@ public void after() throws Exception {
163
169
public void testProtoColumnsUpdateAndRead () {
164
170
assumeFalse (
165
171
"Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
172
+ assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
166
173
SingerInfo singerInfo =
167
174
SingerInfo .newBuilder ().setSingerId (1 ).setNationality ("Country1" ).build ();
168
175
ByteArray singerInfoBytes = ByteArray .copyFrom (singerInfo .toByteArray ());
@@ -270,6 +277,7 @@ public void testProtoColumnsUpdateAndRead() {
270
277
public void testProtoColumnsDMLParameterizedQueriesPKAndIndexes () {
271
278
assumeFalse (
272
279
"Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
280
+ assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
273
281
274
282
SingerInfo singerInfo1 =
275
283
SingerInfo .newBuilder ().setSingerId (1 ).setNationality ("Country1" ).build ();
@@ -376,6 +384,7 @@ public void testProtoColumnsDMLParameterizedQueriesPKAndIndexes() {
376
384
public void testProtoMessageDeserializationError () {
377
385
assumeFalse (
378
386
"Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
387
+ assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
379
388
380
389
SingerInfo singerInfo =
381
390
SingerInfo .newBuilder ().setSingerId (1 ).setNationality ("Country1" ).build ();
0 commit comments