You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/02/24 20:23:54 UTC

[GitHub] [beam] kileys commented on a change in pull request #16609: [BEAM-12572] Java examples should get continuously exercised on at least 2 runners

kileys commented on a change in pull request #16609:
URL: https://github.com/apache/beam/pull/16609#discussion_r814216340



##########
File path: sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/BigqueryClient.java
##########
@@ -381,6 +381,13 @@ private QueryResponse queryWithRetries(
   /** Creates a new dataset. */
   public void createNewDataset(String projectId, String datasetId)
       throws IOException, InterruptedException {
+    createNewDataset(projectId, datasetId, null);
+  }
+
+  /** Creates a new dataset with defaultTableExpiration. */
+  public void createNewDataset(
+      String projectId, String datasetId, @Nullable Long defaultTableExpiration)

Review comment:
       Can you specify that the expiration is in ms?

##########
File path: runners/spark/spark_runner.gradle
##########
@@ -421,10 +421,11 @@ task examplesIntegrationTest(type: Test) {
   systemProperty "spark.ui.showConsoleProgress", "false"
 
   include '**/*IT.class'
+  exclude '**/TriggerExampleIT.class' // OOM Exception

Review comment:
       Is there a Jira for these to be enabled later?

##########
File path: examples/java/src/test/java/org/apache/beam/examples/cookbook/CombinePerKeyExamplesIT.java
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.beam.examples.cookbook;
+
+import static org.junit.Assert.assertEquals;
+
+import com.google.api.client.util.BackOff;
+import com.google.api.client.util.BackOffUtils;
+import com.google.api.client.util.Sleeper;
+import com.google.api.services.bigquery.model.QueryResponse;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
+import org.apache.beam.sdk.extensions.gcp.util.BackOffAdapter;
+import org.apache.beam.sdk.io.gcp.testing.BigqueryClient;
+import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.testing.TestPipelineOptions;
+import org.apache.beam.sdk.util.FluentBackoff;
+import org.joda.time.Duration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** An end-to-end test for {@link org.apache.beam.examples.cookbook.CombinePerKeyExamples}. */
+@RunWith(JUnit4.class)
+public class CombinePerKeyExamplesIT {
+  private CombinePerKeyExamplesOptions options;
+  private final String timestamp = Long.toString(System.currentTimeMillis());
+  private final String outputDatasetId = "combine_per_key_examples" + timestamp;
+  private final String outputTable = "combine_per_key_examples_table";
+  private final Long defaultExpiration = 1000L * 60 * 60;
+  private String projectId;
+  private BigqueryClient bqClient;
+
+  /** Options for the CombinePerKeyExamples Integration Test. */
+  public interface CombinePerKeyExamplesOptions
+      extends TestPipelineOptions, CombinePerKeyExamples.Options {}
+
+  @Before
+  public void setupTestEnvironment() throws Exception {
+    PipelineOptionsFactory.register(TestPipelineOptions.class);
+    this.options = TestPipeline.testingPipelineOptions().as(CombinePerKeyExamplesOptions.class);
+    this.projectId = TestPipeline.testingPipelineOptions().as(GcpOptions.class).getProject();
+    this.bqClient = new BigqueryClient("CombinePerKeyExamplesIT");
+    this.bqClient.createNewDataset(this.projectId, this.outputDatasetId, defaultExpiration);

Review comment:
       Is there a benefit to creating/deleting the datasets? It looks like some integration tests reuse the same dataset with a table expiration




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org