2121import  static  org .junit .Assert .assertNotNull ;
2222import  static  org .junit .Assert .assertThrows ;
2323import  static  org .junit .Assume .assumeFalse ;
24+ import  static  org .junit .Assume .assumeTrue ;
2425
2526import  com .google .cloud .ByteArray ;
2627import  com .google .cloud .spanner .Database ;
5455import  org .junit .AfterClass ;
5556import  org .junit .BeforeClass ;
5657import  org .junit .ClassRule ;
57- import  org .junit .Ignore ;
5858import  org .junit .Test ;
5959import  org .junit .experimental .categories .Category ;
6060import  org .junit .runner .RunWith ;
6161import  org .junit .runners .JUnit4 ;
6262
6363// Integration Tests to test DDL, DML and DQL for Proto Columns and Enums 
64- @ Ignore ("Feature is not yet enabled in production" )
6564@ Category (ParallelIntegrationTest .class )
6665@ RunWith (JUnit4 .class )
6766public  class  ITProtoColumnTest  {
@@ -71,10 +70,17 @@ public class ITProtoColumnTest {
7170  private  static  DatabaseAdminClient  dbAdminClient ;
7271  private  static  DatabaseClient  databaseClient ;
7372
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+ 
7479  @ BeforeClass 
7580  public  static  void  setUpDatabase () throws  Exception  {
7681    assumeFalse (
7782        "Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
83+     assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
7884    RemoteSpannerHelper  testHelper  = env .getTestHelper ();
7985    databaseID  = DatabaseId .of (testHelper .getInstanceId (), testHelper .getUniqueDatabaseId ());
8086    dbAdminClient  = testHelper .getClient ().getDatabaseAdminClient ();
@@ -133,7 +139,7 @@ public static void createDatabase() throws Exception {
133139  @ AfterClass 
134140  public  static  void  afterClass () throws  Exception  {
135141    try  {
136-       if  (!isUsingEmulator ()) {
142+       if  (!isUsingEmulator () &&  isUsingAllowlistedProject () ) {
137143        dbAdminClient .dropDatabase (
138144            databaseID .getInstanceId ().getInstance (), databaseID .getDatabase ());
139145      }
@@ -163,6 +169,7 @@ public void after() throws Exception {
163169  public  void  testProtoColumnsUpdateAndRead () {
164170    assumeFalse (
165171        "Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
172+     assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
166173    SingerInfo  singerInfo  =
167174        SingerInfo .newBuilder ().setSingerId (1 ).setNationality ("Country1" ).build ();
168175    ByteArray  singerInfoBytes  = ByteArray .copyFrom (singerInfo .toByteArray ());
@@ -270,6 +277,7 @@ public void testProtoColumnsUpdateAndRead() {
270277  public  void  testProtoColumnsDMLParameterizedQueriesPKAndIndexes () {
271278    assumeFalse (
272279        "Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
280+     assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
273281
274282    SingerInfo  singerInfo1  =
275283        SingerInfo .newBuilder ().setSingerId (1 ).setNationality ("Country1" ).build ();
@@ -376,6 +384,7 @@ public void testProtoColumnsDMLParameterizedQueriesPKAndIndexes() {
376384  public  void  testProtoMessageDeserializationError () {
377385    assumeFalse (
378386        "Proto Column is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
387+     assumeTrue ("Proto Column is not yet enabled in production" , isUsingAllowlistedProject ());
379388
380389    SingerInfo  singerInfo  =
381390        SingerInfo .newBuilder ().setSingerId (1 ).setNationality ("Country1" ).build ();
0 commit comments