MCPcopy
hub / github.com/cloudfoundry/cli / WithHelloWorldApp

Function WithHelloWorldApp

integration/helpers/app.go:37–49  ·  view source on GitHub ↗

WithHelloWorldApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.

(f func(dir string))

Source from the content-addressed store, hash-verified

35// staticfile_buildpack" so that your app will correctly start up with the
36// proper buildpack.
37func WithHelloWorldApp(f func(dir string)) {
38 dir := TempDirAbsolutePath("", "simple-app")
39 defer os.RemoveAll(dir)
40
41 tempfile := filepath.Join(dir, "index.html")
42 err := os.WriteFile(tempfile, []byte(fmt.Sprintf("hello world %d", rand.Int())), 0666)
43 Expect(err).ToNot(HaveOccurred())
44
45 err = os.WriteFile(filepath.Join(dir, "Staticfile"), nil, 0666)
46 Expect(err).ToNot(HaveOccurred())
47
48 f(dir)
49}
50
51// WithMultiEndpointApp creates a simple application to use with your CLI command
52// (typically CF Push). It has multiple endpoints which are helpful when testing

Calls 2

TempDirAbsolutePathFunction · 0.85
IntMethod · 0.65

Tested by 1

ExampleWithHelloWorldAppFunction · 0.74