@@ -347,29 +347,28 @@ public PipelineResult runWithAdditionalOptionArgs(List<String> additionalArgs) {
347
347
try {
348
348
@ Nullable
349
349
String beamTestPipelineOptions = System .getProperty (PROPERTY_BEAM_TEST_PIPELINE_OPTIONS );
350
- PipelineOptions options ;
351
- if (Strings .isNullOrEmpty (beamTestPipelineOptions )) {
352
- options = PipelineOptionsFactory .create ();
353
- } else {
354
- List <String > args = MAPPER .readValue (beamTestPipelineOptions , List .class );
355
- args .addAll (additionalArgs );
356
- String [] newArgs = new String [args .size ()];
357
- newArgs = args .toArray (newArgs );
358
- options = PipelineOptionsFactory .fromArgs (newArgs ).as (TestPipelineOptions .class );
350
+ List <String > args = new ArrayList <>();
351
+ if (!Strings .isNullOrEmpty (beamTestPipelineOptions )) {
352
+ args .addAll (MAPPER .readValue (beamTestPipelineOptions , List .class ));
359
353
}
354
+ args .addAll (additionalArgs );
355
+ String [] newArgs = new String [args .size ()];
356
+ newArgs = args .toArray (newArgs );
357
+ PipelineOptions newOptions =
358
+ PipelineOptionsFactory .fromArgs (newArgs ).as (TestPipelineOptions .class );
360
359
361
360
// If no options were specified, set some reasonable defaults
362
361
if (Strings .isNullOrEmpty (beamTestPipelineOptions )) {
363
362
// If there are no provided options, check to see if a dummy runner should be used.
364
363
String useDefaultDummy = System .getProperty (PROPERTY_USE_DEFAULT_DUMMY_RUNNER );
365
364
if (!Strings .isNullOrEmpty (useDefaultDummy ) && Boolean .valueOf (useDefaultDummy )) {
366
- options .setRunner (CrashingRunner .class );
365
+ newOptions .setRunner (CrashingRunner .class );
367
366
}
368
367
}
369
- options .setStableUniqueNames (CheckEnabled .ERROR );
368
+ newOptions .setStableUniqueNames (CheckEnabled .ERROR );
370
369
371
370
FileSystems .setDefaultPipelineOptions (options );
372
- return run (options );
371
+ return run (newOptions );
373
372
} catch (IOException e ) {
374
373
throw new RuntimeException (
375
374
"Unable to instantiate test options from system property "
0 commit comments