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

Function WithMultiEndpointApp

integration/helpers/app.go:54–74  ·  view source on GitHub ↗

WithMultiEndpointApp creates a simple application to use with your CLI command (typically CF Push). It has multiple endpoints which are helpful when testing http healthchecks.

(f func(dir string))

Source from the content-addressed store, hash-verified

52// (typically CF Push). It has multiple endpoints which are helpful when testing
53// http healthchecks.
54func WithMultiEndpointApp(f func(dir string)) {
55 dir := TempDirAbsolutePath("", "simple-app")
56 defer os.RemoveAll(dir)
57
58 tempfile := filepath.Join(dir, "index.html")
59 err := os.WriteFile(tempfile, []byte(fmt.Sprintf("hello world %d", rand.Int())), 0666)
60 Expect(err).ToNot(HaveOccurred())
61
62 tempfile = filepath.Join(dir, "other_endpoint.html")
63 err = os.WriteFile(tempfile, []byte("other endpoint"), 0666)
64 Expect(err).ToNot(HaveOccurred())
65
66 tempfile = filepath.Join(dir, "third_endpoint.html")
67 err = os.WriteFile(tempfile, []byte("third endpoint"), 0666)
68 Expect(err).ToNot(HaveOccurred())
69
70 err = os.WriteFile(filepath.Join(dir, "Staticfile"), nil, 0666)
71 Expect(err).ToNot(HaveOccurred())
72
73 f(dir)
74}
75
76func WithSidecarApp(f func(dir string), appName string) {
77 withSidecarManifest := func(dir string) {

Callers 1

Calls 2

TempDirAbsolutePathFunction · 0.85
IntMethod · 0.65

Tested by

no test coverage detected