Skip to content

Commit

Permalink
UOE-11332: bid rejection handling and improve test assertions for Vas…
Browse files Browse the repository at this point in the history
…t version filtering
  • Loading branch information
Pubmatic-Supriya-Patil committed Nov 21, 2024
1 parent 25d1395 commit 4297f1f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion exchange/exchange_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,12 @@ func filterBidsByVastVersion(adapterBids map[openrtb_ext.BidderName]*entities.Pb
Message: fmt.Sprintf("%s Bid %s was filtered for Imp %s with Vast Version %s: Incompatible with GAM unwinding requirements", seatBid.Seat, pbsBid.Bid.ID, pbsBid.Bid.ImpID, vastVersion),
WarningCode: errortypes.InvalidVastVersionWarningCode,
})
rejectedBid = append(rejectedBid, seatBid)
rejectedBid = append(rejectedBid, &entities.PbsOrtbSeatBid{
Seat: seatBid.Seat,
Currency: seatBid.Currency,
HttpCalls: seatBid.HttpCalls,
Bids: []*entities.PbsOrtbBid{pbsBid},
})
continue
}
}
Expand Down
12 changes: 11 additions & 1 deletion exchange/exchange_ow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2306,12 +2306,22 @@ func TestFilterBidsByVastVersion(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
errs := filterBidsByVastVersion(tt.args.adapterBids, tt.args.seatNonBid)
assert.ElementsMatch(t, tt.want, tt.args.adapterBids)
want := mapToSlice(tt.want)
got := mapToSlice(tt.args.adapterBids)
assert.ElementsMatch(t, want, got)
assert.ElementsMatch(t, tt.errs, errs)
})
}
}

func mapToSlice(bidMap map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid) []*entities.PbsOrtbSeatBid {
var result []*entities.PbsOrtbSeatBid
for _, bid := range bidMap {
result = append(result, bid)
}
return result
}

func TestValidateVastVersion(t *testing.T) {
tests := []struct {
name string
Expand Down

0 comments on commit 4297f1f

Please sign in to comment.