-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fn init now respects the --name arg (#386)
Previously the --name arg was ignored and the name of the directory was being used as the name in all cases. Fixes: #385
- Loading branch information
Matthew Gilliard
authored
Aug 16, 2018
1 parent
cfe0b20
commit 9a12306
Showing
2 changed files
with
34 additions
and
0 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,26 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/fnproject/cli/testharness" | ||
) | ||
|
||
func TestSettingFuncName(t *testing.T) { | ||
t.Run("`fn init --name` should set the name in func.yaml", func(t *testing.T) { | ||
t.Parallel() | ||
h := testharness.Create(t) | ||
defer h.Cleanup() | ||
|
||
funcName := h.NewFuncName() | ||
dirName := funcName + "_dir" | ||
h.Fn("init", "--runtime", "java", "--name", funcName, dirName).AssertSuccess() | ||
|
||
h.Cd(dirName) | ||
|
||
yamlFile := h.GetYamlFile("func.yaml") | ||
if yamlFile.Name != funcName { | ||
t.Fatalf("Name was not set to %s in func.yaml", funcName) | ||
} | ||
}) | ||
} |