[
https://issues.apache.org/jira/browse/BEAM-14334?focusedWorklogId=769017&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-769017
]
ASF GitHub Bot logged work on BEAM-14334:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 11/May/22 11:47
Start Date: 11/May/22 11:47
Worklog Time Spent: 10m
Work Description: echauchot commented on code in PR #17406:
URL: https://github.com/apache/beam/pull/17406#discussion_r870202389
##########
runners/spark/src/test/java/org/apache/beam/runners/spark/ProvidedSparkContextTest.java:
##########
@@ -47,72 +54,49 @@ public class ProvidedSparkContextTest {
private static final String PROVIDED_CONTEXT_EXCEPTION =
"The provided Spark context was not created or was stopped";
+ @ClassRule public static SparkContextOptionsRule contextRule = new
SparkContextOptionsRule();
+
/** Provide a context and call pipeline run. */
@Test
- public void testWithProvidedContext() throws Exception {
- JavaSparkContext jsc = new JavaSparkContext("local[*]",
"Existing_Context");
- testWithValidProvidedContext(jsc);
+ public void testAWithProvidedContext() throws Exception {
+ Pipeline p = createPipeline();
+ PipelineResult result = p.run(); // Run test from pipeline
+ result.waitUntilFinish();
+ TestPipeline.verifyPAssertsSucceeded(p, result);
Review Comment:
yes but why not use `TestPipeline.create(contextOptionsRule.getOptions())`
in `createPipeline()` and avoid `TestPipeline.verifyPAssertsSucceeded(p,
result);`
Issue Time Tracking
-------------------
Worklog Id: (was: 769017)
Time Spent: 6h 10m (was: 6h)
> Avoid using forkEvery in Spark runner tests
> -------------------------------------------
>
> Key: BEAM-14334
> URL: https://issues.apache.org/jira/browse/BEAM-14334
> Project: Beam
> Issue Type: Improvement
> Components: runner-spark, testing
> Reporter: Moritz Mack
> Assignee: Moritz Mack
> Priority: P2
> Time Spent: 6h 10m
> Remaining Estimate: 0h
>
> Usage of *{color:#FF0000}forkEvery 1{color}* is typically a strong sign of
> poor quality / bad code and should be avoided:
> * It significantly impacts performance when running tests.
> * And it often hides resource leaks, either in code or worse in the runner
> itself.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)