diff --git a/automl/src/test/java/com/google/cloud/translate/automl/DatasetApiIT.java b/automl/src/test/java/com/google/cloud/translate/automl/DatasetApiIT.java deleted file mode 100644 index bd02bde649e..00000000000 --- a/automl/src/test/java/com/google/cloud/translate/automl/DatasetApiIT.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.translate.automl; - -import static com.google.common.truth.Truth.assertThat; - -import com.google.api.gax.rpc.NotFoundException; -import io.grpc.StatusRuntimeException; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.concurrent.ExecutionException; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Tests for Automl translation "Dataset API" sample. */ -@Ignore("This test is ignored because the legacy version of AutoML API is deprecated") -@RunWith(JUnit4.class) -@SuppressWarnings("checkstyle:abbreviationaswordinname") -public class DatasetApiIT { - - private static final String PROJECT_ID = "java-docs-samples-testing"; - private static final String BUCKET = PROJECT_ID + "-vcm"; - private static final String COMPUTE_REGION = "us-central1"; - private ByteArrayOutputStream bout; - private PrintStream originalPrintStream; - private String datasetId = "TEN0000000000000000000"; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - PrintStream out = new PrintStream(bout); - originalPrintStream = System.out; - System.setOut(out); - } - - @After - public void tearDown() { - // restores print statements in the original method - System.out.flush(); - System.setOut(originalPrintStream); - } - - @Test - public void testCreateImportDeleteDataset() throws IOException, InterruptedException { - try { - DatasetApi.importData( - PROJECT_ID, COMPUTE_REGION, datasetId, "gs://" + BUCKET + "/en-ja-short.csv"); - String got = bout.toString(); - assertThat(got).contains("The Dataset doesn't exist "); - } catch (NotFoundException | ExecutionException | StatusRuntimeException ex) { - assertThat(ex.getMessage()).contains("The Dataset doesn't exist"); - } - } -} diff --git a/batch/snippets/src/test/java/com/example/batch/CreateResourcesIT.java b/batch/snippets/src/test/java/com/example/batch/CreateResourcesIT.java index 03e6ab7ba64..8e4f8242e0b 100644 --- a/batch/snippets/src/test/java/com/example/batch/CreateResourcesIT.java +++ b/batch/snippets/src/test/java/com/example/batch/CreateResourcesIT.java @@ -36,6 +36,7 @@ import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -135,6 +136,7 @@ private static void safeDeleteJob(String jobName) { } } + @Ignore("Canceling jobs not yet GA") @Test public void createBatchCustomServiceAccountTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -148,6 +150,7 @@ public void createBatchCustomServiceAccountTest() Assert.assertNotNull(job.getAllocationPolicy().getServiceAccount().getEmail()); } + @Ignore("Canceling jobs not yet GA") @Test public void createBatchUsingSecretManager() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -164,6 +167,7 @@ public void createBatchUsingSecretManager() -> taskGroup.getTaskSpec().getEnvironment().containsSecretVariables(variableName))); } + @Ignore("Canceling jobs not yet GA") @Test public void createGpuJobTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -181,6 +185,7 @@ public void createGpuJobTest() -> instance.getPolicy().getMachineType().contains(machineType))); } + @Ignore("Canceling jobs not yet GA") @Test public void createGpuJobN1Test() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -199,6 +204,7 @@ public void createGpuJobN1Test() -> accelerator.getType().contains(gpuType) && accelerator.getCount() == count))); } + @Ignore("Canceling jobs not yet GA") @Test public void createLocalSsdJobTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -217,6 +223,7 @@ public void createLocalSsdJobTest() -> attachedDisk.getDeviceName().contains(LOCAL_SSD_NAME)))); } + @Ignore("Canceling jobs not yet GA") @Test public void createPersistentDiskJobTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -243,6 +250,7 @@ public void createPersistentDiskJobTest() -> attachedDisk.getDeviceName().contains(NEW_PERSISTENT_DISK_NAME)))); } + @Ignore("Canceling jobs not yet GA") @Test public void createBatchNotificationTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -263,6 +271,7 @@ public void createBatchNotificationTest() && jobNotification.getMessage().getNewTaskState() == State.FAILED)); } + @Ignore("Canceling jobs not yet GA") @Test public void createBatchCustomEventTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -284,6 +293,7 @@ public void createBatchCustomEventTest() .anyMatch(runnable -> runnable.getDisplayName().equals(displayName)))); } + @Ignore("Canceling jobs not yet GA") @Test public void createScriptJobWithNfsTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -303,6 +313,7 @@ public void createScriptJobWithNfsTest() .anyMatch(volume -> volume.getNfs().getServer().equals(NFS_IP_ADDRESS)))); } + @Ignore("Canceling jobs not yet GA") @Test public void createBatchLabelJobTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -324,6 +335,7 @@ public void createBatchLabelJobTest() Assert.assertTrue(job.getLabelsMap().containsValue(labelValue2)); } + @Ignore("Canceling jobs not yet GA") @Test public void createBatchCustomNetworkTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -346,6 +358,7 @@ public void createBatchCustomNetworkTest() .anyMatch(AllocationPolicy.NetworkInterface::getNoExternalIpAddress)); } + @Ignore("Canceling jobs not yet GA") @Test public void createJobWithAllocationPolicyLabelTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { @@ -368,6 +381,7 @@ public void createJobWithAllocationPolicyLabelTest() Assert.assertTrue(job.getAllocationPolicy().getLabelsMap().containsValue(labelValue2)); } + @Ignore("Canceling jobs not yet GA") @Test public void createBatchRunnableLabelTest() throws IOException, ExecutionException, InterruptedException, TimeoutException { diff --git a/batch/snippets/src/test/java/com/example/batch/Util.java b/batch/snippets/src/test/java/com/example/batch/Util.java index eb4342ac572..5a6635ff71b 100644 --- a/batch/snippets/src/test/java/com/example/batch/Util.java +++ b/batch/snippets/src/test/java/com/example/batch/Util.java @@ -109,7 +109,7 @@ public static void waitForJobCompletion(Job job) String[] jobName = job.getName().split("/"); Instant startTime = Instant.now(); while (WAIT_STATES.contains(job.getStatus().getState())) { - if (Instant.now().getEpochSecond() - startTime.getEpochSecond() > 900) { + if (Instant.now().getEpochSecond() - startTime.getEpochSecond() > 1200) { throw new Error("Timed out waiting for operation to complete."); } job = getJob(jobName[1], jobName[3], jobName[5]);