Repository navigation
chore: add au data center for braze - #4185
Conversation
WalkthroughThe changes focus on enhancing the endpoint resolution logic for Braze integrations. A new function, Changes
Sequence Diagram(s)sequenceDiagram
participant Tester as Test Suite
participant Func as getEndpointFromConfig
Tester->>Func: Call with dataCenter config
Func->>Func: Validate type & trim whitespace
Func->>Func: Split into region and number
alt Region is 'eu', 'us', or 'au'
Func->>Tester: Return appropriate endpoint URL
else Invalid region
Func->>Tester: Throw InstrumentationError
end
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/v0/destinations/braze/braze.util.test.js (1)
1887-1937: Well-structured test suite for the new dataCenter functionality.The test suite comprehensively covers all important scenarios for the new Australian data center support along with existing EU and US regions:
- Valid data center codes for all regions
- Case insensitivity handling
- Whitespace trimming
- Error handling for invalid inputs
Consider adding a few additional test cases:
- Testing with just region codes without instance numbers (e.g., 'EU', 'US', 'AU')
- Testing with malformed region-instance combinations (e.g., 'EU-', 'US-ABC')
describe('getEndpointFromConfig', () => { const testCases = [ { name: 'returns correct EU endpoint', input: { Config: { dataCenter: 'EU-02' } }, expected: 'https://rest.fra-02.braze.eu', }, // existing test cases... + { + name: 'handles region code without instance number', + input: { Config: { dataCenter: 'AU' } }, + expected: 'https://rest.au-01.braze.com', // Assuming default instance + }, + { + name: 'handles malformed region-instance combination', + input: { Config: { dataCenter: 'US-ABC' } }, + throws: true, + errorMessage: 'Invalid Data Center: US-ABC, valid values are EU, US, AU', + }, ]; // rest of the implementation... });src/v0/destinations/braze/util.js (1)
32-54: Good implementation of AU data center support!The enhanced
getEndpointFromConfigfunction properly validates and processes the data center configuration to support the Australian (AU) data centers. The switch statement is a clean approach for determining the appropriate endpoint URL based on the region.Consider making the error messages consistent:
- throw new InstrumentationError('Invalid Data Center: valid values are EU, US, AU'); + throw new InstrumentationError(`Invalid Data Center: ${destination.Config.dataCenter}, valid values are EU, US, AU`);Or alternatively:
- throw new InstrumentationError( - `Invalid Data Center: ${destination.Config.dataCenter}, valid values are EU, US, AU`, - ); + throw new InstrumentationError('Invalid Data Center: valid values are EU, US, AU');
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/v0/destinations/braze/braze.util.test.js(4 hunks)src/v0/destinations/braze/util.js(1 hunks)test/integrations/destinations/braze/processor/data.ts(20 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
src/v0/destinations/braze/braze.util.test.js (3)
10-10: LGTM: Added import for the new function.The addition of
getEndpointFromConfigto the imports is appropriate for testing the new functionality.
347-347: LGTM: Test updated with data center configuration.Adding the
dataCenterproperty to the test destination ensures proper endpoint resolution is tested within the existing test case.
439-439: LGTM: Test updated with data center configuration.Consistently updating all test cases with the
dataCenterproperty ensures comprehensive testing of the endpoint resolution functionality.test/integrations/destinations/braze/processor/data.ts (2)
18-18: New Australian datacenter properly configuredThe changes add support for the Australian datacenter ('au-01') by updating the dataCenter config value and corresponding endpoint URL. This aligns with the PR objective to add AU datacenter support to the Braze integration.
Also applies to: 90-90
231-231: Test cases updated for EU datacenter configurationMultiple test cases have been updated to use 'eu-01' as the datacenter value, ensuring comprehensive test coverage across different datacenter configurations. This is important to maintain test integrity while adding the new AU datacenter support.
Also applies to: 349-349, 727-727, 871-871, 1137-1137, 1243-1243, 1434-1434, 1797-1797, 2029-2029, 3137-3137, 3259-3259, 3330-3330, 3733-3733, 3906-3906, 4219-4219, 4319-4319
|
Allure Test reports for this run are available at:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4185 +/- ##
========================================
Coverage 91.39% 91.39%
========================================
Files 635 636 +1
Lines 33113 33144 +31
Branches 7821 7833 +12
========================================
+ Hits 30262 30293 +31
Misses 2645 2645
Partials 206 206 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|



What are the changes introduced in this PR?
Braze introduced AU datacenters. Enhancing braze integration to handle AU datacenters along side EU and US.
What is the related Linear task?
Resolves INT-3125
Please explain the objectives of your changes below
Keeping up with changes in destination.
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
Yes
Any new dependencies introduced with this change?
No
Any new generic utility introduced or modified. Please explain the changes.
No
Any technical or performance related pointers to consider with the change?
No
@coderabbitai review
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 in new readability format?
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
New Features
Bug Fixes