-
Notifications
You must be signed in to change notification settings - Fork 113
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
feat: update proxy tests for cm360 #3039
Conversation
Added new structure for proxy test scnearios for cm360 also added zod validations as part of tests
Important Auto Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the WalkthroughThe recent update introduces comprehensive schemas for validating proxy and delivery requests and responses, alongside extensive mock data for testing various error scenarios across Google Ads API and other HTTP responses. It enhances integration tests, especially for the Campaign Manager, by implementing new test scenarios, OAuth functionality tests, and error handling cases. Additionally, the update enriches test utilities with Zod validation and augments test case data structures for improved clarity and specificity in testing outcomes. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@coderabbitai review |
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## fix.network-handlers #3039 +/- ##
========================================================
+ Coverage 87.07% 87.13% +0.05%
========================================================
Files 530 531 +1
Lines 28836 28860 +24
Branches 6860 6865 +5
========================================================
+ Hits 25110 25148 +38
+ Misses 3379 3369 -10
+ Partials 347 343 -4 ☔ View full report in Codecov by Sentry. |
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.
Review Status
Actionable comments generated: 25
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
package-lock.json
is excluded by:!**/*.json
package.json
is excluded by:!**/*.json
Files selected for processing (11)
- src/types/zodTypes.ts (1 hunks)
- test/integrations/common/google/network.ts (1 hunks)
- test/integrations/common/network.ts (1 hunks)
- test/integrations/component.test.ts (3 hunks)
- test/integrations/destinations/campaign_manager/dataDelivery/business.ts (1 hunks)
- test/integrations/destinations/campaign_manager/dataDelivery/data.ts (1 hunks)
- test/integrations/destinations/campaign_manager/dataDelivery/oauth.ts (1 hunks)
- test/integrations/destinations/campaign_manager/dataDelivery/other.ts (1 hunks)
- test/integrations/destinations/campaign_manager/network.ts (4 hunks)
- test/integrations/testTypes.ts (1 hunks)
- test/integrations/testUtils.ts (3 hunks)
Additional comments: 13
test/integrations/destinations/campaign_manager/dataDelivery/data.ts (2)
- 1-3: Imports from './business', './oauth', and './other' are correctly added to support the new structure of test scenarios.
- 4-11: The updated
data
export correctly combines scenarios from business, OAuth, and other scenarios for both v0 and v1 APIs, aligning with the PR's objectives to enhance test coverage and standardize testing practices.test/integrations/testTypes.ts (1)
- 34-36: The addition of optional fields
scenario
,successCriteria
, andcomment
to theTestCaseData
interface is a good practice. It allows for more descriptive test cases, aiding in understanding the test's purpose and expected outcomes.test/integrations/common/network.ts (1)
- 1-61: The mock responses for various error scenarios, including SERVICE NOT AVAILABLE, INTERNAL SERVER ERROR, GATEWAY TIME OUT, and null responses, are well-defined. These mocks are essential for testing the robustness of the proxy routes against potential failures.
test/integrations/common/google/network.ts (1)
- 1-108: The mock responses for Google-specific OAuth errors and common HTTP errors are correctly implemented. These mocks are crucial for testing the OAuth flow and error handling in the context of Google APIs, aligning with the PR's objectives to enhance reliability and standardize testing practices.
test/integrations/destinations/campaign_manager/network.ts (1)
- 1-70: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-163]
The introduction of new data structures for common headers, encryption information, and test conversions, along with the updated mock data for network calls, is well-executed. These changes support the PR's objectives to enhance test coverage and standardize testing practices for the Campaign Manager destination.
src/types/zodTypes.ts (1)
- 1-172: The introduction of Zod schemas for validating proxy requests and responses is a significant improvement towards enforcing type safety and improving code reliability. These schemas will help catch errors early in the development process, aligning with the PR's objectives.
test/integrations/component.test.ts (3)
- 19-19: The addition of
validateTestWithZOD
to thetestUtils
module is a good practice for ensuring that test cases are validated against the defined Zod schemas, enhancing the reliability of tests.- 57-57: Modifying the
REPORT_COMPATIBLE_INTEGRATION
constant toINTEGRATIONS_WITH_UPDATED_TEST_STRUCTURE
and adding'campaign_manager'
to its array reflects the inclusion of the Campaign Manager in the updated test structure. This change is consistent with the PR's objectives.- 151-152: The use of
INTEGRATIONS_WITH_UPDATED_TEST_STRUCTURE
and the call tovalidateTestWithZOD
for certain integrations are correctly implemented to ensure that tests for these integrations are validated against the Zod schemas.test/integrations/testUtils.ts (3)
- 380-413: The
generateProxyV0Payload
function is correctly implemented to generate payloads for proxy v0 requests. This function supports the PR's objectives by facilitating the creation of standardized test payloads.- 416-455: The
generateProxyV1Payload
function is correctly implemented to generate payloads for proxy v1 requests. This addition is crucial for testing v1 API endpoints, aligning with the PR's objectives to enhance test coverage.- 462-497: The
validateTestWithZOD
function, which performs Zod validations for different testPayload versions and scenarios, is a significant addition. It ensures that test cases are validated against the defined Zod schemas, enhancing the reliability of tests.
test/integrations/destinations/campaign_manager/dataDelivery/other.ts
Outdated
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/other.ts
Outdated
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/other.ts
Outdated
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/other.ts
Outdated
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/other.ts
Outdated
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/business.ts
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/business.ts
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/business.ts
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/business.ts
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/business.ts
Show resolved
Hide resolved
…usiness.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…usiness.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
2 similar comments
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
secret: {}, | ||
dontBatch: false, | ||
}, | ||
error: 'Floodlight config id: 213123123 was not found., ', |
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.
error: 'Floodlight config id: 213123123 was not found., ', | |
error: 'Floodlight config id: 213123123 was not found.', |
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.
.,
is repeated in all the errors. Any reason?
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.
It is because of this line
errorMsg += `${err.message}, `; |
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 should correct it then.
test/integrations/destinations/campaign_manager/dataDelivery/business.ts
Show resolved
Hide resolved
test/integrations/destinations/campaign_manager/dataDelivery/other.ts
Outdated
Show resolved
Hide resolved
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.
Not full review, I will sync up with you
sourceId: z.string(), | ||
destinationId: z.string(), | ||
workspaceId: z.string(), | ||
secret: z.record(z.unknown()), |
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.
is this mandatory?
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.
https://github.com/rudderlabs/rudder-server/blob/master/router/transformer/transformer.go#L67
From server it will be sent. Possible it could be empty
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.
can we make it optional
test/integrations/common/network.ts
Outdated
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.
can we rename these files to mockNetwork.ts ?
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 mockHandler identifies mock by file name network.ts
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
Test report for this run is available at: https://test-integrations-dev.s3.amazonaws.com/integrations-test-reports/rudder-transformer/3039/test-report.html |
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 6 New issues |
What are the changes introduced in this PR?
The following changes introduces new structure for component tests for proxy routes for cm360. Tests are structured around
business scenarios
oauth scenarios
other 5XX sceanrios
Structure has been defined for central mocking for
oauth
based on destination platform example for cm360 itsgoogle
For common
5XX
scenarios a central mock has been added.Along with that zod validations are added based on type for input and output for proxy routes.
What is the related Linear task?
Resolves INT-1295
Please explain the objectives of your changes below
As part of the reliability efforts a test standardisation needs to be done this covers for component tests for proxy.
Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added?
Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.
Summary by CodeRabbit