-
Notifications
You must be signed in to change notification settings - Fork 224
Tests: Fix flaky GPP tests and refactor code #4309
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
Conversation
|
marki1an
left a comment
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.
Comments applicable to other cases.
|
|
||
| static DataActivity fromGppDataActivity(GppDataActivity gppActivity) { | ||
| if (gppActivity == null) { | ||
| return INVALID; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to move into the core model. In future, we can also reuse this functionality.
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.
Actual
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)] |
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.
same here
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create a rule to format this?
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.
We need to define one standard for all tests with the best practices
| def sensitiveData | ||
| def consentBuilder |
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.
Please use proper Obj instead of def
| def childSensitiveData | ||
| def consentBuilder |
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.
Same here
| @@ -1,3 +1,3 @@ | |||
| package org.prebid.server.functional.model.privacy.gpp | |||
|
|
|||
| import org.prebid.server.functional.util.PBSUtils | |||
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.
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