From e370453cff315c9436d739b50c0800e04e87effa Mon Sep 17 00:00:00 2001 From: Joel Unzain Date: Tue, 1 Oct 2019 11:28:23 -0700 Subject: [PATCH] Prune custom duration type (#45) * Prune custom duration type * update CHANGELOG.md --- CHANGELOG.md | 6 +++++- key/resolverFactory.go | 4 ++-- key/resolverFactory_test.go | 31 ------------------------------- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 465216a..a8f1040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [v0.6.0] +- Prune use of unnecessary custom time.Duration + ## [v0.5.0] - Fixed panic in jws parser - Fixed ClaimsWithLeeway to be unmarshaled into correctly @@ -60,7 +63,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added constructor, enforcer, and listener alice decorators - Basic code and structure established -[Unreleased]: https://github.com/xmidt-org/bascule/compare/v0.5.0...HEAD +[Unreleased]: https://github.com/xmidt-org/bascule/compare/v0.6.0...HEAD +[v0.6.0]: https://github.com/xmidt-org/bascule/compare/0.5.0...v0.6.0 [v0.5.0]: https://github.com/xmidt-org/bascule/compare/0.4.0...v0.5.0 [v0.4.0]: https://github.com/xmidt-org/bascule/compare/0.3.1...v0.4.0 [v0.3.1]: https://github.com/xmidt-org/bascule/compare/0.3.0...v0.3.1 diff --git a/key/resolverFactory.go b/key/resolverFactory.go index b17585d..4ed0e11 100644 --- a/key/resolverFactory.go +++ b/key/resolverFactory.go @@ -2,9 +2,9 @@ package key import ( "fmt" + "time" "github.com/xmidt-org/webpa-common/resource" - "github.com/xmidt-org/webpa-common/types" ) const ( @@ -38,7 +38,7 @@ type ResolverFactory struct { // UpdateInterval specifies how often keys should be refreshed. // If negative or zero, keys are never refreshed and are cached forever. - UpdateInterval types.Duration `json:"updateInterval"` + UpdateInterval time.Duration `json:"updateInterval"` // Parser is a custom key parser. If omitted, DefaultParser is used. Parser Parser `json:"-"` diff --git a/key/resolverFactory_test.go b/key/resolverFactory_test.go index 52d5a03..230d4de 100644 --- a/key/resolverFactory_test.go +++ b/key/resolverFactory_test.go @@ -117,37 +117,6 @@ func TestBadURITemplates(t *testing.T) { } } -// func TestResolverFactoryNewUpdater(t *testing.T) { -// assert := assert.New(t) - -// updateKeysCalled := make(chan struct{}) -// runner := func(mock.Arguments) { -// defer func() { -// recover() // ignore panics from multiple closes -// }() - -// close(updateKeysCalled) -// } - -// keyCache := &MockCache{} -// keyCache.On("UpdateKeys").Return(0, nil).Run(runner) - -// resolverFactory := ResolverFactory{ -// UpdateInterval: types.Duration(100 * time.Millisecond), -// } - -// if updater := resolverFactory.NewUpdater(keyCache); assert.NotNil(updater) { -// waitGroup := &sync.WaitGroup{} -// shutdown := make(chan struct{}) -// updater.Run(waitGroup, shutdown) - -// // we only care that the updater called UpdateKeys() at least once -// <-updateKeysCalled -// close(shutdown) -// waitGroup.Wait() -// } -// } - func TestResolverFactoryDefaultParser(t *testing.T) { assert := assert.New(t)