Skip to content

Commit

Permalink
Rename SignalTestComplete to Shutdown (#2277)
Browse files Browse the repository at this point in the history
SignalTestComplete shouldn't be in the public API and Application should provide a Shutdown method instead. This change is fixing the public API, behavior of Shutdown will be fixed in the future.

Fixes #2260.
  • Loading branch information
rakyll authored Dec 11, 2020
1 parent 7eb2628 commit 4d60560
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ func (app *Application) RegisterZPages(mux *http.ServeMux, pathPrefix string) {
mux.HandleFunc(path.Join(pathPrefix, extensionzPath), app.handleExtensionzRequest)
}

func (app *Application) SignalTestComplete() {
func (app *Application) Shutdown() {
// TODO: Implement a proper shutdown with graceful draining of the pipeline.
// See https://github.com/open-telemetry/opentelemetry-collector/issues/483.
defer func() {
if r := recover(); r != nil {
app.logger.Info("stopTestChan already closed")
Expand Down
4 changes: 2 additions & 2 deletions service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ func TestApplication_StartAsGoRoutine(t *testing.T) {
assert.Equal(t, Starting, <-app.GetStateChannel())
assert.Equal(t, Running, <-app.GetStateChannel())

app.SignalTestComplete()
app.SignalTestComplete()
app.Shutdown()
app.Shutdown()
<-appDone
assert.Equal(t, Closing, <-app.GetStateChannel())
assert.Equal(t, Closed, <-app.GetStateChannel())
Expand Down
2 changes: 1 addition & 1 deletion testbed/testbed/otelcol_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (ipp *InProcessCollector) Start(args StartParams) error {
func (ipp *InProcessCollector) Stop() (stopped bool, err error) {
if !ipp.stopped {
ipp.stopped = true
ipp.svc.SignalTestComplete()
ipp.svc.Shutdown()
}
<-ipp.appDone
stopped = ipp.stopped
Expand Down

0 comments on commit 4d60560

Please sign in to comment.