Tests: Fix flaky GPP tests and refactor code#4309
Conversation
|
marki1an
left a comment
There was a problem hiding this comment.
Comments applicable to other cases.
|
|
||
| static DataActivity fromGppDataActivity(GppDataActivity gppActivity) { | ||
| if (gppActivity == null) { | ||
| return INVALID; |
There was a problem hiding this comment.
Don't need semicolon here.
| NOTICE_NOT_PROVIDED(2), | ||
| NO_CONSENT(1), | ||
| CONSENT(2), | ||
| INVALID(-1), | ||
| INVALID(-1) |
There was a problem hiding this comment.
Please reorder your number without duplication.
| switch (gppActivity) { | ||
| case GppDataActivity.NOT_APPLICABLE: | ||
| return NOT_APPLICABLE | ||
| case GppDataActivity.NO_CONSENT: | ||
| return NO_CONSENT | ||
| case GppDataActivity.CONSENT: | ||
| return CONSENT | ||
| default: | ||
| return INVALID | ||
| } | ||
| } |
There was a problem hiding this comment.
In general, looks weird. Please consider removing the current enum.
| enum ConfigCase { | ||
| CAMEL_CASE, KEBAB_CASE, SNAKE_CASE |
There was a problem hiding this comment.
I propose to move into the core model. In future, we can also reuse this functionality.
src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy
Show resolved
Hide resolved
| accountGppConfig << [ | ||
| new AccountGppConfig(code: IAB_US_GENERAL, enabled: false), | ||
| new AccountGppConfig(code: IAB_US_GENERAL, config: new GppModuleConfig(skipSids: [US_NAT_V1]), enabled: true) | ||
| ] | ||
| accountGppConfig << [new AccountGppConfig(code: IAB_US_GENERAL, enabled: false), | ||
| new AccountGppConfig(code: IAB_US_GENERAL, config: new GppModuleConfig(skipSids: [US_NAT_V1]), enabled: true)] |
| new UsNatV1Consent.Builder().setPersonalDataConsents(GppDataActivity.CONSENT).build() | [new EqualityValueRule(GPC, NOTICE_PROVIDED), | ||
| new EqualityValueRule(PERSONAL_DATA_CONSENTS, NOTICE_NOT_PROVIDED)] | ||
| gppConsent | valueRules | ||
| new UsNatV1Consent.Builder().setPersonalDataConsents(CONSENT).build() | [new EqualityValueRule(PERSONAL_DATA_CONSENTS, DataActivity.NOTICE_NOT_PROVIDED)] |
There was a problem hiding this comment.
DataActivity static import?
| disallowGppLogic << [ | ||
| SIMPLE_GPC_DISALLOW_LOGIC, | ||
| new UsNatV1Consent.Builder() | ||
| .setMspaServiceProviderMode(MspaMode.YES) | ||
| .setMspaOptOutOptionMode(MspaMode.NO) | ||
| .build(), |
There was a problem hiding this comment.
Let's create a rule to format this?
There was a problem hiding this comment.
We need to define one standard for all tests with the best practices
| def sensitiveData | ||
| def consentBuilder |
There was a problem hiding this comment.
Please use proper Obj instead of def
| def childSensitiveData | ||
| def consentBuilder |
There was a problem hiding this comment.
Please remove unused imports, same for others
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check