-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapter alias - syncer changes #3082
Changes from all commits
d96281a
ce30fda
aa619e5
eb836cd
56da6aa
de6d33a
8a54873
049354b
4d3c059
7503c6f
3949a3b
b068aa2
09caa29
98e1911
6ff2f16
2358273
dd12c58
8b64cd6
3416889
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,12 +250,6 @@ func TestProcessBidderInfo(t *testing.T) { | |
PlatformID: "123", | ||
Syncer: &Syncer{ | ||
Key: "foo", | ||
IFrame: &SyncerEndpoint{ | ||
URL: "https://foo.com/sync?mode=iframe&r={{.RedirectURL}}", | ||
RedirectURL: "https://redirect/setuid/iframe", | ||
ExternalURL: "https://iframe.host", | ||
UserMacro: "UID", | ||
}, | ||
}, | ||
UserSyncURL: "user-url", | ||
XAPI: AdapterXAPI{ | ||
|
@@ -281,7 +275,7 @@ func TestProcessBidderInfo(t *testing.T) { | |
} | ||
|
||
func TestProcessAliasBidderInfo(t *testing.T) { | ||
parentBidderInfo := BidderInfo{ | ||
parentWithSyncerKey := BidderInfo{ | ||
AppSecret: "app-secret", | ||
Capabilities: &CapabilitiesInfo{ | ||
App: &PlatformInfo{ | ||
|
@@ -377,8 +371,29 @@ func TestProcessAliasBidderInfo(t *testing.T) { | |
Tracker: "alias-tracker", | ||
}, | ||
} | ||
bidderB := parentBidderInfo | ||
bidderB := parentWithSyncerKey | ||
bidderB.AliasOf = "bidderA" | ||
bidderB.Syncer = &Syncer{ | ||
Key: bidderB.Syncer.Key, | ||
} | ||
|
||
parentWithoutSyncerKey := BidderInfo{ | ||
Syncer: &Syncer{ | ||
IFrame: &SyncerEndpoint{ | ||
URL: "https://foo.com/sync?mode=iframe&r={{.RedirectURL}}", | ||
RedirectURL: "https://redirect/setuid/iframe", | ||
ExternalURL: "https://iframe.host", | ||
UserMacro: "UID", | ||
}, | ||
}, | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is correct. Suggestion - might wanna check if you could reduce There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah you can remove the other fields, just tested it myself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 8b64cd6 makes suggested changes |
||
|
||
bidderC := parentWithoutSyncerKey | ||
bidderC.AliasOf = "bidderA" | ||
bidderC.Syncer = &Syncer{ | ||
Key: "bidderA", | ||
} | ||
|
||
testCases := []struct { | ||
description string | ||
aliasInfos map[string]aliasNillableFields | ||
|
@@ -387,7 +402,7 @@ func TestProcessAliasBidderInfo(t *testing.T) { | |
expectedErr error | ||
}{ | ||
{ | ||
description: "inherit all parent info in alias bidder", | ||
description: "inherit all parent info in alias bidder, use parent syncer key as syncer alias key", | ||
aliasInfos: map[string]aliasNillableFields{ | ||
"bidderB": { | ||
Disabled: nil, | ||
|
@@ -397,14 +412,34 @@ func TestProcessAliasBidderInfo(t *testing.T) { | |
}, | ||
}, | ||
bidderInfos: BidderInfos{ | ||
"bidderA": parentBidderInfo, | ||
"bidderA": parentWithSyncerKey, | ||
"bidderB": BidderInfo{ | ||
AliasOf: "bidderA", | ||
// all other fields should be inherited from parent bidder | ||
}, | ||
}, | ||
expectedErr: nil, | ||
expectedBidderInfos: BidderInfos{"bidderA": parentBidderInfo, "bidderB": bidderB}, | ||
expectedBidderInfos: BidderInfos{"bidderA": parentWithSyncerKey, "bidderB": bidderB}, | ||
}, | ||
{ | ||
description: "inherit all parent info in alias bidder, use parent name as syncer alias key", | ||
aliasInfos: map[string]aliasNillableFields{ | ||
"bidderC": { | ||
Disabled: nil, | ||
ModifyingVastXmlAllowed: nil, | ||
Experiment: nil, | ||
XAPI: nil, | ||
}, | ||
}, | ||
bidderInfos: BidderInfos{ | ||
"bidderA": parentWithoutSyncerKey, | ||
"bidderC": BidderInfo{ | ||
AliasOf: "bidderA", | ||
// all other fields should be inherited from parent bidder | ||
}, | ||
}, | ||
expectedErr: nil, | ||
expectedBidderInfos: BidderInfos{"bidderA": parentWithoutSyncerKey, "bidderC": bidderC}, | ||
}, | ||
{ | ||
description: "all bidder info specified for alias, do not inherit from parent bidder", | ||
|
@@ -417,11 +452,11 @@ func TestProcessAliasBidderInfo(t *testing.T) { | |
}, | ||
}, | ||
bidderInfos: BidderInfos{ | ||
"bidderA": parentBidderInfo, | ||
"bidderA": parentWithSyncerKey, | ||
"bidderB": aliasBidderInfo, | ||
}, | ||
expectedErr: nil, | ||
expectedBidderInfos: BidderInfos{"bidderA": parentBidderInfo, "bidderB": aliasBidderInfo}, | ||
expectedBidderInfos: BidderInfos{"bidderA": parentWithSyncerKey, "bidderB": aliasBidderInfo}, | ||
}, | ||
{ | ||
description: "invalid alias", | ||
|
@@ -449,7 +484,7 @@ func TestProcessAliasBidderInfo(t *testing.T) { | |
if test.expectedErr != nil { | ||
assert.Equal(t, test.expectedErr, err) | ||
} else { | ||
assert.Equal(t, test.expectedBidderInfos, bidderInfos) | ||
assert.Equal(t, test.expectedBidderInfos, bidderInfos, test.description) | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question regarding a case you laid out in your PR description:
Would this be referring to scenario where
parentBidderInfo.Syncer == nil
? And if so, where in this PR is the code that allows the alias to inherit the entire parent syncer cfg?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexBVolcy, we leverage on existing
BuildSyncer()
function to inherit parent cfg for alias.As per adapter aliases feature, bidders (parent. + aliases ) can share user sync cfg as follow:
We have
BuildSyncer()
function that,prebid-server/usersync/syncersbuilder.go
Line 28 in 831dd71
In this way, alias inherit the entire parent syncer cfg. Case where
parentBidderInfo.Syncer == nil
is already handled byBuildSyncer()
. So changes were needed as part of this PR.