From 911ecdb5bb17facd567a4383935bff56138aadec Mon Sep 17 00:00:00 2001 From: Owen Cabalceta Date: Wed, 1 Nov 2023 17:54:49 -0400 Subject: [PATCH] chore: patch tests --- basculehttp/basicTokenFactory_test.go | 8 +++++--- basculehttp/bearerTokenFactory_test.go | 8 +++++--- basculehttp/provide_test.go | 13 +++++++++---- go.mod | 1 + go.sum | 4 ++++ 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/basculehttp/basicTokenFactory_test.go b/basculehttp/basicTokenFactory_test.go index a6626d4..0a76876 100644 --- a/basculehttp/basicTokenFactory_test.go +++ b/basculehttp/basicTokenFactory_test.go @@ -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) { @@ -181,7 +183,7 @@ bad: return nil, err } - return gc, nil + return gc, gc.Compile() }, ), sallust.WithLogger(), @@ -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 diff --git a/basculehttp/bearerTokenFactory_test.go b/basculehttp/bearerTokenFactory_test.go index 3e37109..ecde248 100644 --- a/basculehttp/bearerTokenFactory_test.go +++ b/basculehttp/bearerTokenFactory_test.go @@ -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) { @@ -202,7 +204,7 @@ good: return nil, err } - return gc, nil + return gc, gc.Compile() }, ), sallust.WithLogger(), @@ -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 diff --git a/basculehttp/provide_test.go b/basculehttp/provide_test.go index 8136bcd..10aa06b 100644 --- a/basculehttp/provide_test.go +++ b/basculehttp/provide_test.go @@ -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) { @@ -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) @@ -48,7 +53,6 @@ capabilities: t, // supplying dependencies - sallust.WithLogger(), fx.Supply(l), touchstone.Provide(), fx.Provide( @@ -73,7 +77,7 @@ capabilities: return nil, err } - return gc, nil + return gc, gc.Compile() }, ), @@ -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 + ` @@ -150,7 +156,6 @@ capabilities: t, // supplying dependencies - sallust.WithLogger(), fx.Supply(l), touchstone.Provide(), fx.Provide( @@ -175,7 +180,7 @@ capabilities: return nil, err } - return gc, nil + return gc, gc.Compile() }, ), // the parts we care about diff --git a/go.mod b/go.mod index 3368554..97cdb89 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index e2a3292..5ac19ff 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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=