Skip to content

Commit

Permalink
fix: use noop tracer for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Jun 22, 2024
1 parent d633fb9 commit 8053408
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/authenticator/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/snapp-incubator/soteria/internal/config"
"github.com/snapp-incubator/soteria/internal/topics"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/trace/noop"
"go.uber.org/zap"
)

Expand All @@ -18,6 +19,7 @@ func TestBuilderWithoutAuthenticator(t *testing.T) {
b := authenticator.Builder{
Vendors: []config.Vendor{},
Logger: zap.NewNop(),
Tracer: noop.NewTracerProvider().Tracer(""),
ValidatorConfig: config.Validator{
URL: "",
Timeout: 0,
Expand All @@ -34,6 +36,7 @@ func TestBuilderInvalidAuthenticator(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "internal",
Expand Down Expand Up @@ -70,6 +73,7 @@ func TestBuilderInternalAuthenticator(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "internal",
Expand Down Expand Up @@ -108,6 +112,7 @@ func TestBuilderInternalAuthenticatorWithInvalidKey(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "admin",
Expand Down Expand Up @@ -144,6 +149,7 @@ func TestBuilderManualAuthenticatorWithoutKey(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "snapp",
Expand Down Expand Up @@ -198,6 +204,7 @@ func TestBuilderManualAuthenticator(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "snapp",
Expand Down Expand Up @@ -274,6 +281,7 @@ func TestBuilderManualAuthenticatorInvalidMapping_1(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "snapp",
Expand Down Expand Up @@ -344,6 +352,7 @@ func TestBuilderManualAuthenticatorInvalidMapping_2(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "snapp",
Expand Down Expand Up @@ -417,6 +426,7 @@ func TestBuilderManualAuthenticatorInvalidAccess(t *testing.T) {
require := require.New(t)

b := authenticator.Builder{
Tracer: noop.NewTracerProvider().Tracer(""),
Vendors: []config.Vendor{
{
Company: "snapp",
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/serve/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func (s Serve) main() {
Vendors: s.Cfg.Vendors,
Logger: s.Logger,
ValidatorConfig: s.Cfg.Validator,
Tracer: s.Tracer,
}.Authenticators()
if err != nil {
s.Logger.Fatal("authenticator building failed", zap.Error(err))
Expand Down

0 comments on commit 8053408

Please sign in to comment.