Skip to content

Commit

Permalink
chore: patch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
denopink committed Nov 1, 2023
1 parent 06bfccf commit 911ecdb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
8 changes: 5 additions & 3 deletions basculehttp/basicTokenFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"github.com/xmidt-org/bascule"
"github.com/xmidt-org/sallust"
"go.uber.org/fx"

_ "github.com/goschtalt/yaml-decoder"
)

func TestBasicTokenFactory(t *testing.T) {
Expand Down Expand Up @@ -181,7 +183,7 @@ bad:
return nil, err
}

return gc, nil
return gc, gc.Compile()
},
),
sallust.WithLogger(),
Expand All @@ -194,8 +196,8 @@ bad:
)
err := app.Err()
if tc.expectedErr == nil {
assert.NoError(err)
assert.True(len(result.Options) == 1)
require.NoError(err)
require.True(len(result.Options) == 1)
if tc.optionExpected {
require.NotNil(result.Options[0])
return
Expand Down
8 changes: 5 additions & 3 deletions basculehttp/bearerTokenFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"github.com/xmidt-org/bascule"
"github.com/xmidt-org/sallust"
"go.uber.org/fx"

_ "github.com/goschtalt/yaml-decoder"
)

func TestBearerTokenFactory(t *testing.T) {
Expand Down Expand Up @@ -202,7 +204,7 @@ good:
return nil, err
}

return gc, nil
return gc, gc.Compile()
},
),
sallust.WithLogger(),
Expand All @@ -215,8 +217,8 @@ good:
)
err := app.Err()
if tc.expectedErr == nil {
assert.NoError(err)
assert.True(len(result.Options) == 1)
require.NoError(err)
require.True(len(result.Options) == 1)
if tc.optionExpected {
require.NotNil(result.Options[0])
return
Expand Down
13 changes: 9 additions & 4 deletions basculehttp/provide_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"go.uber.org/fx"
"go.uber.org/fx/fxtest"
"go.uber.org/zap"

_ "github.com/goschtalt/yaml-decoder"
)

func TestProvideBearerMiddleware(t *testing.T) {
Expand All @@ -30,11 +32,14 @@ bearer:
uri: "http://test:1111/keys/{keyId}"
purpose: 0
updateInterval: 604800000000000
leeway:
expLeeway: 5
capabilities:
endpoints:
".*/a/.*": "whatsup"
".*/b/.*": "nm"
default: "eh"
`
l, err := zap.NewDevelopment()
require.NoError(err)
Expand All @@ -48,7 +53,6 @@ capabilities:
t,

// supplying dependencies
sallust.WithLogger(),
fx.Supply(l),
touchstone.Provide(),
fx.Provide(
Expand All @@ -73,7 +77,7 @@ capabilities:
return nil, err
}

return gc, nil
return gc, gc.Compile()
},
),

Expand Down Expand Up @@ -113,6 +117,8 @@ bearer:
uri: "http://test:1111/keys/{keyId}"
purpose: 0
updateInterval: 604800000000000
leeway:
expLeeway: 5
`
var yamls = map[string]string{
"everything included": basicAuth + bearerAuth + `
Expand Down Expand Up @@ -150,7 +156,6 @@ capabilities:
t,

// supplying dependencies
sallust.WithLogger(),
fx.Supply(l),
touchstone.Provide(),
fx.Provide(
Expand All @@ -175,7 +180,7 @@ capabilities:
return nil, err
}

return gc, nil
return gc, gc.Compile()
},
),
// the parts we care about
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/go-kit/kit v0.13.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/goschtalt/goschtalt v0.22.1
github.com/goschtalt/yaml-decoder v0.0.1
github.com/justinas/alice v1.2.0
github.com/prometheus/client_golang v1.17.0
github.com/spf13/cast v1.5.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,8 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/goschtalt/goschtalt v0.22.1 h1:IcfNMSQMouZUsZnlzQlvGeVaDPJX1oB+hPPXXonpRq8=
github.com/goschtalt/goschtalt v0.22.1/go.mod h1:GRY3xnUO5EerjBnsm+k7Xk3unZ71Qgj73gdhutc27IY=
github.com/goschtalt/yaml-decoder v0.0.1 h1:fwXf5OoC2tUm6+FOzMizvh6UITFALw6OWxJTVNgbJwg=
github.com/goschtalt/yaml-decoder v0.0.1/go.mod h1:b+hYjmM/e9rzRhPB8EKlb+LUwrgntMrOpqEAel3wRGQ=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
Expand Down Expand Up @@ -1471,6 +1473,8 @@ github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPH
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef h1:NKxTG6GVGbfMXc2mIk+KphcH6hagbVXhcFkbTgYleTI=
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef/go.mod h1:tcaRap0jS3eifrEEllL6ZMd9dg8IlDpi2S1oARrQ+NI=
github.com/rabbitmq/amqp091-go v1.5.0/go.mod h1:JsV0ofX5f1nwOGafb8L5rBItt9GyhfQfcJj+oyz0dGg=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down

0 comments on commit 911ecdb

Please sign in to comment.