MCPcopy Index your code
hub / github.com/cloudfoundry/cli / WithRandomHomeDir

Function WithRandomHomeDir

integration/helpers/config.go:43–49  ·  view source on GitHub ↗

WithRandomHomeDir sets CF_HOME and CF_PLUGIN_HOME to a temp directory and outputs the created directory through GinkgoWriter. Then it executes the provided function 'action'. Finally, it’s restoring the previous CF_HOME and CF_PLUGIN_HOME.

(action func())

Source from the content-addressed store, hash-verified

41// the created directory through GinkgoWriter. Then it executes the provided function
42// 'action'. Finally, it’s restoring the previous CF_HOME and CF_PLUGIN_HOME.
43func WithRandomHomeDir(action func()) {
44 oldHomeDir, oldPluginHomeDir := getHomeDirs()
45 homeDir := SetHomeDir()
46 action()
47 setHomeDirsTo(oldHomeDir, oldPluginHomeDir)
48 DestroyHomeDir(homeDir)
49}
50
51func getHomeDirs() (string, string) {
52 homeDir := os.Getenv("CF_HOME")

Callers 2

ensureAppIsPushedFunction · 0.92

Calls 4

getHomeDirsFunction · 0.85
SetHomeDirFunction · 0.85
setHomeDirsToFunction · 0.85
DestroyHomeDirFunction · 0.85

Tested by

no test coverage detected