2020-10-26 18:20:49 +02:00
|
|
|
// Copyright The OpenTelemetry Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package trace
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
export "go.opentelemetry.io/otel/sdk/export/trace"
|
|
|
|
)
|
|
|
|
|
|
|
|
type basicSpanProcesor struct {
|
|
|
|
running bool
|
|
|
|
}
|
|
|
|
|
2020-10-27 04:06:55 +02:00
|
|
|
func (t *basicSpanProcesor) Shutdown(context.Context) error {
|
2020-10-26 18:20:49 +02:00
|
|
|
t.running = false
|
2020-10-27 04:06:55 +02:00
|
|
|
return nil
|
2020-10-26 18:20:49 +02:00
|
|
|
}
|
|
|
|
|
2020-11-16 18:45:49 +02:00
|
|
|
func (t *basicSpanProcesor) OnStart(parent context.Context, s *export.SpanData) {}
|
|
|
|
func (t *basicSpanProcesor) OnEnd(s *export.SpanData) {}
|
|
|
|
func (t *basicSpanProcesor) ForceFlush() {}
|
2020-10-26 18:20:49 +02:00
|
|
|
|
|
|
|
func TestShutdownTraceProvider(t *testing.T) {
|
|
|
|
stp := NewTracerProvider()
|
|
|
|
sp := &basicSpanProcesor{}
|
|
|
|
stp.RegisterSpanProcessor(sp)
|
|
|
|
|
|
|
|
sp.running = true
|
|
|
|
|
|
|
|
_ = stp.Shutdown(context.Background())
|
|
|
|
|
|
|
|
if sp.running != false {
|
|
|
|
t.Errorf("Error shutdown basicSpanProcesor\n")
|
|
|
|
}
|
|
|
|
}
|