當前位置: 首頁>>代碼示例>>Golang>>正文


Golang test.CreateTmpHome函數代碼示例

本文整理匯總了Golang中github.com/helm/helm/test.CreateTmpHome函數的典型用法代碼示例。如果您正苦於以下問題:Golang CreateTmpHome函數的具體用法?Golang CreateTmpHome怎麽用?Golang CreateTmpHome使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CreateTmpHome函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的github.com/helm/helm/test.CreateTmpHome函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。