本文整理汇总了Golang中github.com/helm/helm/test.CreateTmpHome函数的典型用法代码示例。如果您正苦于以下问题:Golang CreateTmpHome函数的具体用法?Golang CreateTmpHome怎么用?Golang CreateTmpHome使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateTmpHome函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestLintChartByPath
func TestLintChartByPath(t *testing.T) {
home1 := test.CreateTmpHome()
home2 := test.CreateTmpHome()
chartName := "goodChart"
action.Create(chartName, home1)
output := test.CaptureOutput(func() {
Cli().Run([]string{"helm", "--home", home2, "lint", util.WorkspaceChartDirectory(home1, chartName)})
})
test.ExpectContains(t, output, fmt.Sprintf("Chart [%s] has passed all necessary checks", chartName))
}
开发者ID:michelleN,项目名称:helm,代码行数:13,代码来源:lint_test.go
示例2: TestLintEmptyChartYaml
func TestLintEmptyChartYaml(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
chartName := "badChart"
Create(chartName, tmpHome)
badChartYaml, _ := yaml.Marshal(make(map[string]string))
chartYaml := util.WorkspaceChartDirectory(tmpHome, chartName, Chartfile)
os.Remove(chartYaml)
ioutil.WriteFile(chartYaml, badChartYaml, 0644)
output := test.CaptureOutput(func() {
Lint(util.WorkspaceChartDirectory(tmpHome, chartName))
})
test.ExpectContains(t, output, "Chart.yaml has a name field : false")
test.ExpectContains(t, output, "Chart.yaml has a version field : false")
test.ExpectContains(t, output, "Chart.yaml has a description field : false")
test.ExpectContains(t, output, "Chart.yaml has a maintainers field : false")
test.ExpectContains(t, output, fmt.Sprintf("Chart [%s] has failed some necessary checks", chartName))
}
开发者ID:michelleN,项目名称:helm,代码行数:25,代码来源:lint_test.go
示例3: TestEnsurePrereqs
func TestEnsurePrereqs(t *testing.T) {
pp := os.Getenv("PATH")
defer os.Setenv("PATH", pp)
os.Setenv("PATH", filepath.Join(test.HelmRoot, "testdata")+":"+pp)
homedir := test.CreateTmpHome()
CheckAllPrereqs(homedir)
}
开发者ID:michelleN,项目名称:helm,代码行数:9,代码来源:doctor_test.go
示例4: TestLintAllNone
func TestLintAllNone(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
output := test.CaptureOutput(func() {
Cli().Run([]string{"helm", "--home", tmpHome, "lint", "--all"})
})
test.ExpectContains(t, output, fmt.Sprintf("Could not find any charts in \"%s", tmpHome))
}
开发者ID:michelleN,项目名称:helm,代码行数:10,代码来源:lint_test.go
示例5: TestLintBadPath
func TestLintBadPath(t *testing.T) {
tmpHome := test.CreateTmpHome()
chartName := "badChart"
output := test.CaptureOutput(func() {
Lint(util.WorkspaceChartDirectory(tmpHome, chartName))
})
msg := "Chart found at " + tmpHome + "/workspace/charts/" + chartName + " : false"
test.ExpectContains(t, output, msg)
}
开发者ID:michelleN,项目名称:helm,代码行数:11,代码来源:lint_test.go
示例6: TestFetch
func TestFetch(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
chartName := "kitchensink"
actual := test.CaptureOutput(func() {
Fetch(chartName, "", tmpHome)
})
workspacePath := util.WorkspaceChartDirectory(tmpHome, chartName)
test.ExpectContains(t, actual, "Fetched chart into workspace "+workspacePath)
}
开发者ID:2opremio,项目名称:helm,代码行数:12,代码来源:fetch_test.go
示例7: TestListRepos
func TestListRepos(t *testing.T) {
log.IsDebugging = true
homedir := test.CreateTmpHome()
test.FakeUpdate(homedir)
actual := test.CaptureOutput(func() {
ListRepos(homedir)
})
test.ExpectContains(t, actual, "charts*\thttps://github.com/helm/charts")
}
开发者ID:michelleN,项目名称:helm,代码行数:12,代码来源:repo_test.go
示例8: TestLintSingle
func TestLintSingle(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
chartName := "goodChart"
action.Create(chartName, tmpHome)
output := test.CaptureOutput(func() {
Cli().Run([]string{"helm", "--home", tmpHome, "lint", chartName})
})
test.ExpectContains(t, output, fmt.Sprintf("Chart [%s] has passed all necessary checks", chartName))
}
开发者ID:michelleN,项目名称:helm,代码行数:13,代码来源:lint_test.go
示例9: TestLintMismatchedChartNameAndDir
func TestLintMismatchedChartNameAndDir(t *testing.T) {
tmpHome := test.CreateTmpHome()
chartName := "chart-0"
chartDir := "chart-1"
chart := newSkelChartfile(chartName)
createWithChart(chart, chartDir, tmpHome)
output := test.CaptureOutput(func() {
Lint(util.WorkspaceChartDirectory(tmpHome, chartDir))
})
test.ExpectContains(t, output, "Name declared in Chart.yaml is the same as directory name. : false")
}
开发者ID:michelleN,项目名称:helm,代码行数:13,代码来源:lint_test.go
示例10: TestSearchNotFound
func TestSearchNotFound(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
// test that a "no chart found" message was printed
expected := "No results found"
actual := test.CaptureOutput(func() {
Search("nonexistent", tmpHome, false)
})
test.ExpectContains(t, actual, expected)
}
开发者ID:michelleN,项目名称:helm,代码行数:13,代码来源:search_test.go
示例11: TestInfoFormat
func TestInfoFormat(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
format := `Hello {{.Name}}`
expected := `Hello kitchensink`
actual := test.CaptureOutput(func() {
Info("kitchensink", tmpHome, format)
})
test.ExpectContains(t, actual, expected)
}
开发者ID:michelleN,项目名称:helm,代码行数:14,代码来源:info_test.go
示例12: TestLintMissingReadme
func TestLintMissingReadme(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
chartName := "badChart"
Create(chartName, tmpHome)
os.Remove(filepath.Join(util.WorkspaceChartDirectory(tmpHome, chartName), "README.md"))
output := test.CaptureOutput(func() {
Lint(util.WorkspaceChartDirectory(tmpHome, chartName))
})
test.ExpectContains(t, output, "README.md is present and not empty : false")
}
开发者ID:michelleN,项目名称:helm,代码行数:16,代码来源:lint_test.go
示例13: TestLintSuccess
func TestLintSuccess(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
chartName := "goodChart"
Create(chartName, tmpHome)
output := test.CaptureOutput(func() {
Lint(util.WorkspaceChartDirectory(tmpHome, chartName))
})
expected := "Chart [goodChart] has passed all necessary checks"
test.ExpectContains(t, output, expected)
}
开发者ID:michelleN,项目名称:helm,代码行数:16,代码来源:lint_test.go
示例14: TestLintMissingManifestDirectory
func TestLintMissingManifestDirectory(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
chartName := "brokeChart"
Create(chartName, tmpHome)
os.RemoveAll(filepath.Join(util.WorkspaceChartDirectory(tmpHome, chartName), "manifests"))
output := test.CaptureOutput(func() {
Lint(util.WorkspaceChartDirectory(tmpHome, chartName))
})
test.ExpectMatches(t, output, "Manifests directory is present : false")
test.ExpectContains(t, output, "Chart ["+chartName+"] has failed some necessary checks")
}
开发者ID:michelleN,项目名称:helm,代码行数:17,代码来源:lint_test.go
示例15: TestLintMissingChartYaml
func TestLintMissingChartYaml(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
chartName := "badChart"
Create(chartName, tmpHome)
os.Remove(filepath.Join(util.WorkspaceChartDirectory(tmpHome, chartName), Chartfile))
output := test.CaptureOutput(func() {
Lint(util.WorkspaceChartDirectory(tmpHome, chartName))
})
test.ExpectContains(t, output, "Chart.yaml is present : false")
test.ExpectContains(t, output, "Chart [badChart] has failed some necessary checks.")
}
开发者ID:michelleN,项目名称:helm,代码行数:17,代码来源:lint_test.go
示例16: TestEdit
func TestEdit(t *testing.T) {
editor := os.Getenv("EDITOR")
os.Setenv("EDITOR", "echo")
defer os.Setenv("EDITOR", editor)
tmpHome := test.CreateTmpHome()
defer os.RemoveAll(tmpHome)
test.FakeUpdate(tmpHome)
Fetch("redis", "", tmpHome)
expected := path.Join(tmpHome, "workspace/charts/redis")
actual := test.CaptureOutput(func() {
Edit("redis", tmpHome)
})
test.ExpectContains(t, actual, expected)
}
开发者ID:michelleN,项目名称:helm,代码行数:18,代码来源:edit_test.go
示例17: TestGenerate
func TestGenerate(t *testing.T) {
ch := "generate"
homedir := test.CreateTmpHome()
test.FakeUpdate(homedir)
Fetch(ch, ch, homedir)
Generate(ch, homedir, []string{"ignore"})
// Now we should be able to load and read the `pod.yaml` file.
path := util.WorkspaceChartDirectory(homedir, "generate/manifests/pod.yaml")
d, err := ioutil.ReadFile(path)
if err != nil {
t.Fatal(err)
}
pod := string(d)
test.ExpectContains(t, pod, "image: ozo")
test.ExpectContains(t, pod, "name: www-server")
}
开发者ID:michelleN,项目名称:helm,代码行数:18,代码来源:generate_test.go
示例18: TestInfo
func TestInfo(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
format := ""
expected := `Name: kitchensink
Home: http://github.com/helm/helm
Version: 0.0.1
Description: All the things, all semantically, none working
Details: This package provides a sampling of all of the different manifest types. It can be used to test ordering and other properties of a chart.`
actual := test.CaptureOutput(func() {
Info("kitchensink", tmpHome, format)
})
test.ExpectContains(t, actual, expected)
}
开发者ID:michelleN,项目名称:helm,代码行数:18,代码来源:info_test.go
示例19: TestUninstall
func TestUninstall(t *testing.T) {
tests := []struct {
name string // Todo: print name on fail
chart string
force bool
expected []string
client kubectl.Runner
}{
{
name: "with valid input",
chart: "redis",
force: true,
expected: []string{"Running `kubectl delete` ...", "hello from redis"},
client: TestRunner{
out: []byte("hello from redis"),
},
},
{
name: "with a kubectl error",
chart: "redis",
force: true,
expected: []string{"Running `kubectl delete` ...", "Could not delete Pod redis (Skipping): oh snap"},
client: TestRunner{
err: errors.New("oh snap"),
},
},
}
tmpHome := test.CreateTmpHome()
defer os.RemoveAll(tmpHome)
test.FakeUpdate(tmpHome)
for _, tt := range tests {
Fetch(tt.chart, "", tmpHome)
actual := test.CaptureOutput(func() {
Uninstall(tt.chart, tmpHome, "", tt.force, tt.client)
})
for _, exp := range tt.expected {
test.ExpectContains(t, actual, exp)
}
}
}
开发者ID:michelleN,项目名称:helm,代码行数:44,代码来源:uninstall_test.go
示例20: TestLintAll
func TestLintAll(t *testing.T) {
tmpHome := test.CreateTmpHome()
test.FakeUpdate(tmpHome)
missingReadmeChart := "missingReadme"
action.Create(missingReadmeChart, tmpHome)
os.Remove(util.WorkspaceChartDirectory(tmpHome, missingReadmeChart, "README.md"))
action.Create("goodChart", tmpHome)
output := test.CaptureOutput(func() {
Cli().Run([]string{"helm", "--home", tmpHome, "lint", "--all"})
})
test.ExpectMatches(t, output, "A README file was not found.*"+missingReadmeChart)
test.ExpectContains(t, output, "Chart [goodChart] has passed all necessary checks")
test.ExpectContains(t, output, "Chart [missingReadme] failed some checks")
}
开发者ID:michelleN,项目名称:helm,代码行数:19,代码来源:lint_test.go
注:本文中的github.com/helm/helm/test.CreateTmpHome函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论