Skip to content

Commit cc7f429

Browse files
committed
return an error when Envoy fails to start
mixer and backend should also do this, but that involves slightly more work.
1 parent 145ffb3 commit cc7f429

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

mixer/test/client/env/envoy.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ func (s *TestSetup) NewEnvoy(stress, faultInject bool, mfConf *MixerFilterConf,
7171
// Start starts the envoy process
7272
func (s *Envoy) Start() error {
7373
err := s.cmd.Start()
74-
if err == nil {
75-
url := fmt.Sprintf("http://localhost:%v/server_info", s.ports.AdminPort)
76-
WaitForHTTPServer(url)
77-
WaitForPort(s.ports.ClientProxyPort)
78-
WaitForPort(s.ports.ServerProxyPort)
74+
if err != nil {
75+
return err
7976
}
80-
return err
77+
78+
url := fmt.Sprintf("http://localhost:%v/server_info", s.ports.AdminPort)
79+
WaitForHTTPServer(url)
80+
WaitForPort(s.ports.ClientProxyPort)
81+
WaitForPort(s.ports.ServerProxyPort)
82+
83+
return nil
8184
}
8285

8386
// Stop stops the envoy process

mixer/test/client/env/http_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func NewHTTPServer(port uint16) (*HTTPServer, error) {
128128
}
129129

130130
// Start starts the server
131+
// TODO: Add a channel so this can return an error
131132
func (s *HTTPServer) Start() {
132133
go func() {
133134
http.HandleFunc("/", handler)

mixer/test/client/env/mixer_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ func NewMixerServer(port uint16, stress bool) (*MixerServer, error) {
154154
}
155155

156156
// Start starts the mixer server
157+
// TODO: Add a channel so this can return an error
157158
func (ts *MixerServer) Start() {
158159
go func() {
159160
err := ts.gs.Serve(ts.lis)

mixer/test/client/env/setup.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ func (s *TestSetup) SetUp() error {
154154
s.envoy, err = s.NewEnvoy(s.stress, s.faultInject, s.mfConf, s.ports, s.epoch, s.mfConfVersion)
155155
if err != nil {
156156
log.Printf("unable to create Envoy %v", err)
157-
} else {
158-
_ = s.envoy.Start()
157+
}
158+
159+
err = s.envoy.Start()
160+
if err != nil {
161+
return err
159162
}
160163

161164
if !s.noMixer {

tests/e2e/tests/pilot/cloudfoundry/copilot_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ func TestWildcardHostEdgeRouterWithMockCopilot(t *testing.T) {
154154
}
155155

156156
t.Log("run envoy...")
157-
testEnv.SetUp()
157+
if err := testEnv.SetUp(); err != nil {
158+
t.Fatalf("Failed to setup test: %v", err)
159+
}
158160
defer testEnv.TearDown()
159161

160162
t.Log("curling the app with expected host header")

0 commit comments

Comments
 (0)