[ https://issues.apache.org/jira/browse/BEAM-7961?focusedWorklogId=377890&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-377890 ]
ASF GitHub Bot logged work on BEAM-7961: ---------------------------------------- Author: ASF GitHub Bot Created on: 27/Jan/20 22:54 Start Date: 27/Jan/20 22:54 Worklog Time Spent: 10m Work Description: chamikaramj commented on pull request #10051: [BEAM-7961] Add tests for all runner native transforms for XLang URL: https://github.com/apache/beam/pull/10051#discussion_r371523701 ########## File path: runners/core-construction-java/src/test/java/org/apache/beam/runners/core/construction/ValidateRunnerXlangTest.java ########## @@ -0,0 +1,227 @@ +/* + * 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.runners.core.construction; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.io.Serializable; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import org.apache.beam.sdk.PipelineResult; +import org.apache.beam.sdk.options.ExperimentalOptions; +import org.apache.beam.sdk.testing.PAssert; +import org.apache.beam.sdk.testing.TestPipeline; +import org.apache.beam.sdk.testing.UsesCrossLanguageTransforms; +import org.apache.beam.sdk.testing.ValidatesRunner; +import org.apache.beam.sdk.transforms.Create; +import org.apache.beam.sdk.transforms.MapElements; +import org.apache.beam.sdk.transforms.join.KeyedPCollectionTuple; +import org.apache.beam.sdk.values.KV; +import org.apache.beam.sdk.values.PCollection; +import org.apache.beam.sdk.values.PCollectionList; +import org.apache.beam.sdk.values.PCollectionTuple; +import org.apache.beam.sdk.values.TypeDescriptors; +import org.apache.beam.vendor.grpc.v1p21p0.io.grpc.ConnectivityState; +import org.apache.beam.vendor.grpc.v1p21p0.io.grpc.ManagedChannel; +import org.apache.beam.vendor.grpc.v1p21p0.io.grpc.ManagedChannelBuilder; +import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList; +import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Test External transforms. */ +@RunWith(JUnit4.class) +public class ValidateRunnerXlangTest implements Serializable { + @Rule public transient TestPipeline testPipeline = TestPipeline.create(); + private PipelineResult pipelineResult; + + private static final String TEST_PREFIX_URN = "beam:transforms:xlang:test:prefix"; + private static final String TEST_MULTI_URN = "beam:transforms:xlang:test:multi"; + private static final String TEST_GBK_URN = "beam:transforms:xlang:test:gbk"; + private static final String TEST_CGBK_URN = "beam:transforms:xlang:test:cgbk"; + private static final String TEST_COMGL_URN = "beam:transforms:xlang:test:comgl"; + private static final String TEST_COMPK_URN = "beam:transforms:xlang:test:compk"; + private static final String TEST_FLATTEN_URN = "beam:transforms:xlang:test:flatten"; + private static final String TEST_PARTITION_URN = "beam:transforms:xlang:test:partition"; + + private static String expansionAddr; + private static String expansionJar; + + @BeforeClass + public static void setUpClass() { + expansionAddr = + String.format("localhost:%s", Integer.valueOf(System.getProperty("expansionPort"))); + expansionJar = System.getProperty("expansionJar"); + } + + @Before + public void setUp() { + testPipeline + .getOptions() + .as(ExperimentalOptions.class) + .setExperiments(ImmutableList.of("jar_packages=" + expansionJar)); + waitForReady(); + } + + @After + public void tearDown() { + pipelineResult.waitUntilFinish(); + assertThat(pipelineResult.getState(), equalTo(PipelineResult.State.DONE)); + } + + private void waitForReady() { + try { + ManagedChannel channel = ManagedChannelBuilder.forTarget(expansionAddr).build(); + ConnectivityState state = channel.getState(true); + for (int retry = 0; retry < 30 && state != ConnectivityState.READY; retry++) { + Thread.sleep(500); + state = channel.getState(true); + } + channel.shutdownNow(); + } catch (InterruptedException e) { + throw new RuntimeException("interrupted."); + } + } + + @Test + @Category({ValidatesRunner.class, UsesCrossLanguageTransforms.class}) Review comment: Please address or resolve. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 377890) Time Spent: 17h 40m (was: 17.5h) > Add tests for all runner native transforms and some widely used composite > transforms to cross-language validates runner test suite > ---------------------------------------------------------------------------------------------------------------------------------- > > Key: BEAM-7961 > URL: https://issues.apache.org/jira/browse/BEAM-7961 > Project: Beam > Issue Type: Improvement > Components: testing > Reporter: Heejong Lee > Assignee: Heejong Lee > Priority: Major > Time Spent: 17h 40m > Remaining Estimate: 0h > > Add tests for all runner native transforms and some widely used composite > transforms to cross-language validates runner test suite -- This message was sent by Atlassian Jira (v8.3.4#803005)