(t *testing.T, mainFlags map[string]string)
| 101 | } |
| 102 | |
| 103 | func configureAndBootPumaDevServer(t *testing.T, mainFlags map[string]string) error { |
| 104 | StubCommandLineArgs() |
| 105 | for flagName, flagValue := range mainFlags { |
| 106 | SetFlagOrFail(t, flagName, flagValue) |
| 107 | } |
| 108 | |
| 109 | address := fmt.Sprintf("localhost:%d", *fHTTPPort) |
| 110 | timeout := time.Duration(2 * time.Second) |
| 111 | |
| 112 | if _, err := net.DialTimeout("tcp", address, timeout); err == nil { |
| 113 | return fmt.Errorf("server is already running") |
| 114 | } |
| 115 | |
| 116 | generateLivePumaDevCertIfNotExist(t) |
| 117 | |
| 118 | go func() { |
| 119 | main() |
| 120 | }() |
| 121 | |
| 122 | return retry.Do( |
| 123 | func() error { |
| 124 | _, err := net.DialTimeout("tcp", address, timeout) |
| 125 | return err |
| 126 | }, |
| 127 | ) |
| 128 | } |
| 129 | |
| 130 | func generateLivePumaDevCertIfNotExist(t *testing.T) { |
| 131 | liveSupportPath := homedir.MustExpand(dev.SupportDir) |
no test coverage detected