-
Notifications
You must be signed in to change notification settings - Fork 770
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
Rubicon: Remove pchain support #4166
Rubicon: Remove pchain support #4166
Conversation
Code coverage summaryNote:
rubiconRefer here for heat map coverage report
|
Code coverage summaryNote:
rubiconRefer here for heat map coverage report
|
Code coverage summaryNote:
rubiconRefer here for heat map coverage report
|
|
||
sourceCopyExt.SChain = sourceCopy.SChain | ||
sourceCopy.SChain = nil | ||
if request.Source != nil && request.Source.SChain != nil { |
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.
Consider the following test case:
{
desc: "3) non-nil source, pchain = \"\", nil SChain",
in: testInput{
request: &openrtb2.BidRequest{
Source: &openrtb2.Source{TID: "someSourceTID"},
},
pChain: "",
},
},
The &&
operator will prevent the request.Source
to get copied to rubiconRequest.Source
causing a loss of information that request.Source
might be carrying, like the request.Source.TID
field set to "someSourceTID"
in our example. Is this the desired behavior?
If not, 4 of the 6 scenarios considered below, fail because of this logic.
func TestFunc(t *testing.T) {
type testInput struct {
request *openrtb2.BidRequest
pChain string
}
testCases := []struct {
desc string
in testInput
}{
{
desc: "1) nil Source, pchain = \"\"",
in: testInput{
request: &openrtb2.BidRequest{},
pChain: "",
},
},
{
desc: "2) nil Source, pchain = \"pchain\"",
in: testInput{
request: &openrtb2.BidRequest{},
pChain: "pchain",
},
},
{
desc: "3) non-nil source, pchain = \"\", nil SChain",
in: testInput{
request: &openrtb2.BidRequest{
Source: &openrtb2.Source{TID: "someSourceTID"},
},
pChain: "",
},
},
{
desc: "4) non-nil Source, pchain = \"\", non-nil SChain",
in: testInput{
request: &openrtb2.BidRequest{
Source: &openrtb2.Source{
TID: "someSourceTID",
SChain: &openrtb2.SupplyChain{
Complete: 0,
},
},
},
pChain: "",
},
},
{
desc: "5) non-nil Source, pchain = \"pchain\", nil SChain",
in: testInput{
request: &openrtb2.BidRequest{
Source: &openrtb2.Source{TID: "someSourceTID"},
},
pChain: "pchain",
},
},
{
desc: "6) non-nil Source, pchain = \"pchain\", non-nil SChain",
in: testInput{
request: &openrtb2.BidRequest{
Source: &openrtb2.Source{
TID: "someSourceTID",
SChain: &openrtb2.SupplyChain{
Complete: 0,
},
},
},
pChain: "pchain",
},
},
}
for _, tc := range testCases {
beforeResult := &openrtb2.BidRequest{}
afterResult := &openrtb2.BidRequest{}
before(tc.in.request, beforeResult, tc.in.pChain)
after(tc.in.request, afterResult, tc.in.pChain)
assert.Equal(t, beforeResult, afterResult, tc.desc)
}
}
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.
The only reason to change the source is having a schain
field, otherwise we don't even need to make a copy of the source
I don't see any information loss since the rubiconRequest is a copy of request and the source is kept unchanged
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.
LGTM
No description provided.