This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed: CLI breaks with multiple spaces in submit args (#193)
- Loading branch information
1 parent
e686c93
commit 17e2483
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
// test spaces | ||
func TestCleanUpSubmitArgs(t *testing.T) { | ||
_, args := sparkSubmitArgSetup() | ||
inputArgs := "--conf spark.app.name=kerberosStreaming --conf spark.cores.max=8" | ||
submitArgs, _ := cleanUpSubmitArgs(inputArgs, args.boolVals) | ||
if "--conf=spark.app.name=kerberosStreaming" != submitArgs[0] { | ||
t.Errorf("Failed to reduce spaces while cleaning submit args.") | ||
} | ||
|
||
if "--conf=spark.cores.max=8" != submitArgs[1] { | ||
t.Errorf("Failed to reduce spaces while cleaning submit args.") | ||
} | ||
} | ||
|
||
// test scopts pattern for app args when have full submit args | ||
func TestScoptAppArgs(t *testing.T) { | ||
_, args := sparkSubmitArgSetup() | ||
inputArgs := `--driver-cores 1 --conf spark.cores.max=1 --driver-memory 512M | ||
--class org.apache.spark.examples.SparkPi http://spark-example.jar --input1 value1 --input2 value2` | ||
submitArgs, appFlags := cleanUpSubmitArgs(inputArgs, args.boolVals) | ||
|
||
if "--input1" != appFlags[0] { | ||
t.Errorf("Failed to parse app args.") | ||
} | ||
if "value1" != appFlags[1] { | ||
t.Errorf("Failed to parse app args.") | ||
} | ||
|
||
if "--driver-memory=512M" != submitArgs[2] { | ||
t.Errorf("Failed to parse submit args..") | ||
} | ||
if "http://spark-example.jar" != submitArgs[4] { | ||
t.Errorf("Failed to parse submit args..") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters