MCPcopy
hub / github.com/puma/puma-dev / configureAndBootPumaDevServer

Function configureAndBootPumaDevServer

cmd/puma-dev/main_test.go:103–128  ·  view source on GitHub ↗
(t *testing.T, mainFlags map[string]string)

Source from the content-addressed store, hash-verified

101}
102
103func 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
130func generateLivePumaDevCertIfNotExist(t *testing.T) {
131 liveSupportPath := homedir.MustExpand(dev.SupportDir)

Calls 5

StubCommandLineArgsFunction · 0.85
SetFlagOrFailFunction · 0.85
DoMethod · 0.80
mainFunction · 0.70

Tested by

no test coverage detected