Skip to content

Commit

Permalink
Bump db (#114)
Browse files Browse the repository at this point in the history
* Bumped db to v0.3.1 and bumped bascule and made necessary changes

* updated release notes

* fixed unit tests
  • Loading branch information
kristinapathak authored and kcajmagic committed Nov 16, 2019
1 parent d92f155 commit e86362b
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 40 deletions.
9 changes: 4 additions & 5 deletions acquirer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ import (
)

// determineTokenAcquirer always returns a valid TokenAcquirer
func determineTokenAcquirer(config WebhookConfig) acquire.Acquirer {
func determineTokenAcquirer(config WebhookConfig) (acquire.Acquirer, error) {
defaultAcquirer := &acquire.DefaultAcquirer{}
if config.JWT.AuthURL != "" && config.JWT.Buffer != 0 && config.JWT.Timeout != 0 {
acquirer := acquire.NewJWTAcquirer(config.JWT)
return &acquirer
return acquire.NewRemoteBearerTokenAcquirer(config.JWT)
}

if config.Basic != "" {
return acquire.NewBasicAcquirer(config.Basic)
return acquire.NewFixedAuthAcquirer(config.Basic)
}

return defaultAcquirer
return defaultAcquirer, nil
}
10 changes: 6 additions & 4 deletions acquirer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ import (

func TestDetermineTokenAcquirer(t *testing.T) {
defaultAcquirer := &acquire.DefaultAcquirer{}
goodBasicAcquirer := acquire.NewBasicAcquirer("test basic")
options := acquire.JWTAcquirerOptions{
goodBasicAcquirer, err := acquire.NewFixedAuthAcquirer("test basic")
assert.Nil(t, err)
options := acquire.RemoteBearerTokenAcquirerOptions{
AuthURL: "/test",
Timeout: 10 * time.Minute,
Buffer: 5 * time.Second,
}
tests := []struct {
description string
jwtConfig acquire.JWTAcquirerOptions
jwtConfig acquire.RemoteBearerTokenAcquirerOptions
basicVal string
expectJWT bool
expectedTokenAcquirer acquire.Acquirer
Expand Down Expand Up @@ -63,7 +64,8 @@ func TestDetermineTokenAcquirer(t *testing.T) {
JWT: tc.jwtConfig,
Basic: tc.basicVal,
}
tokenAcquirer := determineTokenAcquirer(config)
tokenAcquirer, err := determineTokenAcquirer(config)
assert.Nil(err)
if tc.expectJWT {
assert.NotEqual(goodBasicAcquirer, tokenAcquirer)
assert.NotEqual(defaultAcquirer, tokenAcquirer)
Expand Down
17 changes: 8 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ module github.com/xmidt-org/svalinn
go 1.12

require (
github.com/InVisionApp/go-health v2.1.0+incompatible
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
github.com/InVisionApp/go-health/v2 v2.1.2
github.com/c9s/goprocinfo v0.0.0-20190309065803-0b2ad9ac246b // indirect
github.com/go-kit/kit v0.8.0
github.com/goph/emperror v0.17.2
github.com/go-kit/kit v0.9.0
github.com/goph/emperror v0.17.3-0.20190703203600-60a8d9faa17b
github.com/gorilla/mux v1.7.3
github.com/justinas/alice v0.0.0-20171023064455-03f45bd4b7da
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.3.0
github.com/xmidt-org/bascule v0.3.1
github.com/xmidt-org/codex-db v0.2.0
github.com/stretchr/testify v1.4.0
github.com/xmidt-org/bascule v0.5.0
github.com/xmidt-org/codex-db v0.3.1
github.com/xmidt-org/voynicrypto v0.1.1
github.com/xmidt-org/webpa-common v1.3.0
github.com/xmidt-org/wrp-go v1.2.0
github.com/xmidt-org/webpa-common v1.4.0
github.com/xmidt-org/wrp-go v1.3.4
github.com/xmidt-org/wrp-listener v0.1.1
)
Loading

0 comments on commit e86362b

Please sign in to comment.