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))
| 52 | // (typically CF Push). It has multiple endpoints which are helpful when testing |
| 53 | // http healthchecks. |
| 54 | func 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 | |
| 76 | func WithSidecarApp(f func(dir string), appName string) { |
| 77 | withSidecarManifest := func(dir string) { |
no test coverage detected