Skip to content

Commit

Permalink
[ASCII-1979] add FxLoggingOption() fx option to our testing utility f…
Browse files Browse the repository at this point in the history
…unctions to ensure logs are not being written by default (#27510)
  • Loading branch information
GustavoCaso authored Jul 15, 2024
1 parent d6018ec commit a8f7ee2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/util/fxutil/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func Test[T any](t testing.TB, opts ...fx.Option) T {

app := fxtest.New(
t,
FxLoggingOption(),
fx.Provide(newFxLifecycleAdapter),
fx.Supply(fx.Annotate(t, fx.As(new(testing.TB)))),
delayed.option(),
Expand Down Expand Up @@ -64,6 +65,7 @@ func TestApp[T any](opts ...fx.Option) (*fx.App, T, error) {
})

app := fx.New(
FxLoggingOption(),
delayed.option(),
fx.Provide(newFxLifecycleAdapter),
fx.Options(opts...),
Expand Down Expand Up @@ -97,6 +99,7 @@ type appAssertFn func(testing.TB, *fx.App)
func TestStart(t testing.TB, opts fx.Option, appAssert appAssertFn, fn interface{}) {
delayed := newDelayedFxInvocation(fn)
app := fx.New(
FxLoggingOption(),
fx.Supply(fx.Annotate(t, fx.As(new(testing.TB)))),
fx.Provide(newFxLifecycleAdapter),
delayed.option(),
Expand Down Expand Up @@ -169,6 +172,7 @@ func TestOneShotSubcommand(
// build an app without the oneShotFunc, and with verifyFn
app := fxtest.New(t,
append(opts,
FxLoggingOption(),
fx.Provide(newFxLifecycleAdapter),
fx.Supply(fx.Annotate(t, fx.As(new(testing.TB)))),
fx.Invoke(verifyFn))...)
Expand Down

0 comments on commit a8f7ee2

Please sign in to comment.