Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cf = func(args ...string) *gexec.Session { cmdStarter := commandstarter.NewCommandStarter() return internal.Cf(cmdStarter, args...) }
View Source
var CfRedact = func(stringToRedact string, args ...string) *gexec.Session { var ( redactor internal.Redactor redactingReporter internal.Reporter ) cmdStarter := silentcommandstarter.NewCommandStarter() redactor = internal.NewRedactor(stringToRedact) redactingReporter = internal.NewRedactingReporter(ginkgo.GinkgoWriter, redactor) return internal.CfWithCustomReporter(cmdStarter, redactingReporter, args...) }
View Source
var CfWithStdin = func(stdin io.Reader, args ...string) *gexec.Session { cmdStarter := commandstarter.NewCommandStarterWithStdin(stdin) return internal.Cf(cmdStarter, args...) }
CfWithStdin can be used to prepare arbitrary terminal input from the user in the tests. Here is an example of how it can be used:
inputConfirmingPrompt := bytes.NewBufferString("yes\n") session := cf.CfWithStdin(inputConfirmingPrompt, "update-service", "my-service", "--upgrade") Eventually(session).Should(Exit(0))
View Source
var Push = func(appName string, args ...string) *gexec.Session { tmpDir, err := ioutil.TempDir("", "") if err != nil { panic(err) } app := Application{ Name: appName, } for i := 0; i < len(args); i += 2 { switch args[i] { case "-b": app.Buildpacks = append(app.Buildpacks, args[i+1]) case "-c": app.Command = args[i+1] case "-d": app.Routes = append(app.Routes, map[string]string{"route": fmt.Sprintf("%s.%s", appName, args[i+1])}) case "-i": instances, err := strconv.Atoi(args[i+1]) if err != nil { panic(err) } app.Instances = instances case "-m": app.Memory = args[i+1] case "-p": path, err := filepath.Abs(args[i+1]) if err != nil { panic(err) } app.Path = path } } manifest := Manifest{} manifest.Applications = append(manifest.Applications, app) manifestText, err := yaml.Marshal(manifest) if err != nil { panic(err) } manifestPath := filepath.Join(tmpDir, "manifest.yml") err = ioutil.WriteFile(manifestPath, manifestText, 0644) if err != nil { panic(err) } fmt.Fprintf( ginkgo.GinkgoWriter, "\n[%s]> Generated app manifest:\n%s\n", time.Now().UTC().Format("2006-01-02 15:04:05.00 (MST)"), string(manifestText), ) return Cf("push", "-f", manifestPath, ) }
Functions ¶
Types ¶
type Application ¶
type Manifest ¶
type Manifest struct {
Applications []Application
}
Click to show internal directories.
Click to hide internal directories.