Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into OTT-1412_new
  • Loading branch information
Ankit-Pinge committed Nov 7, 2023
2 parents 2fe82bf + 2a2d2db commit 4d41829
Show file tree
Hide file tree
Showing 29 changed files with 129 additions and 185 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/PubMatic-OpenWrap/prebid-server

go 1.20

replace git.pubmatic.com/vastunwrap => git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231012062530-95f4848c9fb7
replace git.pubmatic.com/vastunwrap => git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231102070946-3c5a3bc1dff5

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231012062530-95f4848c9fb7 h1:YD51mgFU5YJX6ufDBO19QIx/vX38uk7bxNhxYfqEytA=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231012062530-95f4848c9fb7/go.mod h1:dgTumQ6/KYeLbpWq3HVOaqkZos6Q0QGwZmQmEIhQ3To=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231102070946-3c5a3bc1dff5 h1:nK2YP3aS8+5dwc5cMJ8IxI0Sh7yfd858LKmcvwfkOUo=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20231102070946-3c5a3bc1dff5/go.mod h1:dgTumQ6/KYeLbpWq3HVOaqkZos6Q0QGwZmQmEIhQ3To=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
Expand Down
18 changes: 9 additions & 9 deletions modules/pubmatic/openwrap/cache/gocache/adunit_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func Test_cache_populateCacheWithAdunitConfig(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
}
type args struct {
Expand All @@ -177,7 +177,7 @@ func Test_cache_populateCacheWithAdunitConfig(t *testing.T) {
fields: fields{
cache: gocache.New(10, 10),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand All @@ -200,7 +200,7 @@ func Test_cache_populateCacheWithAdunitConfig(t *testing.T) {
fields: fields{
cache: gocache.New(10, 10),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand All @@ -223,7 +223,7 @@ func Test_cache_populateCacheWithAdunitConfig(t *testing.T) {
fields: fields{
cache: gocache.New(10, 10),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand Down Expand Up @@ -277,7 +277,7 @@ func Test_cache_GetAdunitConfigFromCache(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
}
type args struct {
Expand All @@ -300,7 +300,7 @@ func Test_cache_GetAdunitConfigFromCache(t *testing.T) {
name: "test_request",
fields: fields{
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand All @@ -321,7 +321,7 @@ func Test_cache_GetAdunitConfigFromCache(t *testing.T) {
name: "successfully_get_value_from_cache",
fields: fields{
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand All @@ -345,7 +345,7 @@ func Test_cache_GetAdunitConfigFromCache(t *testing.T) {
name: "got_empty_adunitconfig_from_cache",
fields: fields{
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand All @@ -370,7 +370,7 @@ func Test_cache_GetAdunitConfigFromCache(t *testing.T) {
fields: fields{
cache: gocache.New(100, 100),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestGetFSCDisabledPublishers(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
}
tests := []struct {
Expand All @@ -49,7 +49,7 @@ func TestGetFSCDisabledPublishers(t *testing.T) {
fields: fields{
cache: gocache.New(100, 100),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand All @@ -65,7 +65,7 @@ func TestGetFSCDisabledPublishers(t *testing.T) {
fields: fields{
cache: gocache.New(100, 100),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestGetFSCThresholdPerDSP(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
}
tests := []struct {
Expand All @@ -129,7 +129,7 @@ func TestGetFSCThresholdPerDSP(t *testing.T) {
fields: fields{
cache: gocache.New(100, 100),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand All @@ -145,7 +145,7 @@ func TestGetFSCThresholdPerDSP(t *testing.T) {
fields: fields{
cache: gocache.New(100, 100),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand Down
4 changes: 2 additions & 2 deletions modules/pubmatic/openwrap/cache/gocache/gocache.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ func key(format string, v ...interface{}) string {
type cache struct {
sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
metricEngine metrics.MetricsEngine
}

var c *cache
var cOnce sync.Once

func New(goCache *gocache.Cache, database database.Database, cfg config.DBCache, metricEngine metrics.MetricsEngine) *cache {
func New(goCache *gocache.Cache, database database.Database, cfg config.Cache, metricEngine metrics.MetricsEngine) *cache {
cOnce.Do(
func() {
c = &cache{
Expand Down
12 changes: 6 additions & 6 deletions modules/pubmatic/openwrap/cache/gocache/gocache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestNew(t *testing.T) {
type args struct {
goCache *gocache.Cache
database database.Database
cfg config.DBCache
cfg config.Cache
metricsEngine metrics.MetricsEngine
}
tests := []struct {
Expand All @@ -64,7 +64,7 @@ func TestNew(t *testing.T) {
args: args{
goCache: gocache.New(100, 100),
database: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
metricsEngine: mockEngine,
Expand Down Expand Up @@ -113,7 +113,7 @@ func Test_cache_Set(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
}
type args struct {
Expand All @@ -131,7 +131,7 @@ func Test_cache_Set(t *testing.T) {
fields: fields{
cache: gocache.New(100, 100),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand Down Expand Up @@ -172,7 +172,7 @@ func Test_cache_Get(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
}
type args struct {
Expand All @@ -190,7 +190,7 @@ func Test_cache_Get(t *testing.T) {
fields: fields{
cache: gocache.New(100, 100),
db: mockDatabase,
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
},
},
Expand Down
20 changes: 10 additions & 10 deletions modules/pubmatic/openwrap/cache/gocache/partner_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Test_cache_GetPartnerConfigMap(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
}
type args struct {
pubID int
Expand All @@ -40,7 +40,7 @@ func Test_cache_GetPartnerConfigMap(t *testing.T) {
name: "get_valid_partnerConfig_map",
fields: fields{
cache: gocache.New(100, 100),
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
VASTTagCacheExpiry: 1000,
},
Expand Down Expand Up @@ -89,7 +89,7 @@ func Test_cache_GetPartnerConfigMap(t *testing.T) {
name: "db_queries_failed_getting_partnerConfig_map",
fields: fields{
cache: gocache.New(100, 100),
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
VASTTagCacheExpiry: 1000,
},
Expand Down Expand Up @@ -119,7 +119,7 @@ func Test_cache_GetPartnerConfigMap(t *testing.T) {
name: "db_queries_failed_getting_adunitconfig_and_wrapper_slotmappings",
fields: fields{
cache: gocache.New(100, 100),
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
VASTTagCacheExpiry: 1000,
},
Expand Down Expand Up @@ -183,7 +183,7 @@ func Test_cache_GetPartnerConfigMap_LockandLoad(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
}
type args struct {
pubID int
Expand All @@ -203,7 +203,7 @@ func Test_cache_GetPartnerConfigMap_LockandLoad(t *testing.T) {
name: "get_partnerConfig_map",
fields: fields{
cache: gocache.New(100, 100),
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 1000,
VASTTagCacheExpiry: 1000,
},
Expand Down Expand Up @@ -282,7 +282,7 @@ func Test_cache_getActivePartnerConfigAndPopulateWrapperMappings(t *testing.T) {
type fields struct {
Map sync.Map
cache *gocache.Cache
cfg config.DBCache
cfg config.Cache
db database.Database
}
type args struct {
Expand All @@ -306,7 +306,7 @@ func Test_cache_getActivePartnerConfigAndPopulateWrapperMappings(t *testing.T) {
name: "error_returning_Active_partner_configuration_from_DB",
fields: fields{
cache: gocache.New(100, 100),
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 100,
},
db: mockDatabase,
Expand All @@ -330,7 +330,7 @@ func Test_cache_getActivePartnerConfigAndPopulateWrapperMappings(t *testing.T) {
name: "non_nil_partnerConfigMap_from_DB",
fields: fields{
cache: gocache.New(100, 100),
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 100,
},
db: mockDatabase,
Expand Down Expand Up @@ -375,7 +375,7 @@ func Test_cache_getActivePartnerConfigAndPopulateWrapperMappings(t *testing.T) {
name: "empty_partnerConfigMap_from_DB",
fields: fields{
cache: gocache.New(100, 100),
cfg: config.DBCache{
cfg: config.Cache{
CacheDefaultExpiry: 100,
},
db: mockDatabase,
Expand Down
Loading

0 comments on commit 4d41829

Please sign in to comment.