Skip to content

Commit

Permalink
add ut
Browse files Browse the repository at this point in the history
Change-Id: Ib0003a387cb9d23592f28fd8097bc49ff3ae2351
  • Loading branch information
shunjiazhu committed Dec 26, 2024
1 parent 5838f78 commit d891ca6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/flusher/opentelemetry/flusher_otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ func (t *TestOtlpLogService) Export(ctx context.Context, request *otlpv1.ExportL
}

func Test_Flusher_Init(t *testing.T) {
convey.Convey("When config is invalid", t, func() {
convey.Convey("When FlusherOTLP is not initialized", func() {
f := &FlusherOTLP{Version: v1, Logs: &helper.GrpcClientConfig{Endpoint: ":8080"}}
err := f.Stop()
convey.So(err, convey.ShouldBeNil)
})
})
convey.Convey("When init grpc service", t, func() {
_, server := newTestGrpcService(t, ":8080", time.Nanosecond)
defer func() {
Expand All @@ -61,6 +68,8 @@ func Test_Flusher_Init(t *testing.T) {
f := &FlusherOTLP{Version: v1, Logs: &helper.GrpcClientConfig{Endpoint: ":8080"}}
err := f.Init(logCtx)
convey.So(err, convey.ShouldBeNil)
err = f.Stop()
convey.So(err, convey.ShouldBeNil)
})
})
}
Expand Down

0 comments on commit d891ca6

Please sign in to comment.