@@ -56,44 +56,23 @@ public class BigtableMaterializedViewIT {
5656 private static final int [] BACKOFF_DURATION = {2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 };
5757
5858 private static BigtableInstanceAdminClient client ;
59- private static BigtableTableAdminClient tableAdminClient ;
6059 private static Table testTable ;
61- private static String instanceId = "" ;
60+ private String instanceId = testEnvRule . env (). getInstanceId () ;
6261
6362 // TODO: Update this test once emulator supports InstanceAdmin operation
6463 // https://github.com/googleapis/google-cloud-go/issues/1069
6564 @ BeforeClass
66- public static void validatePlatform () throws IOException {
65+ public static void validatePlatform () {
6766 assume ()
6867 .withMessage ("BigtableInstanceAdminClient doesn't support on Emulator" )
6968 .that (testEnvRule .env ())
7069 .isNotInstanceOf (EmulatorEnv .class );
71-
72- createInstance ();
73- }
74-
75- public static void createInstance () throws IOException {
76- client = testEnvRule .env ().getInstanceAdminClient ();
77-
78- Instance instance =
79- client .createInstance (
80- CreateInstanceRequest .of (new PrefixGenerator ().newPrefix ())
81- .addCluster ("my-cluster" , "us-east1-c" , 3 , StorageType .SSD ));
82- instanceId = instance .getId ();
83- tableAdminClient =
84- BigtableTableAdminClient .create (testEnvRule .env ().getProjectId (), instanceId );
85- }
86-
87- @ AfterClass
88- public static void deleteInstance () {
89- if (!instanceId .isEmpty ()) {
90- client .deleteInstance (instanceId );
91- }
9270 }
9371
9472 @ Before
9573 public void setUp () throws InterruptedException {
96- testTable = createTestTable (tableAdminClient );
74+ client = testEnvRule .env ().getInstanceAdminClient ();
75+ testTable = createTestTable (testEnvRule .env ().getTableAdminClient ());
9776 }
9877
9978 @ Test
0 commit comments