Skip to content

Commit

Permalink
refactor: trade desk proxy testcases (#3175)
Browse files Browse the repository at this point in the history
* refactor: trade desk proxy testcases

* test: add network failure testcases

* doc: add trade desk error doc

* chore: format koala testcases
  • Loading branch information
Gauravudia authored Mar 12, 2024
1 parent 541b596 commit e43b83d
Show file tree
Hide file tree
Showing 7 changed files with 575 additions and 319 deletions.
58 changes: 31 additions & 27 deletions test/integrations/destinations/koala/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const data = [
value: 10,
},
context: {
network: 'wifi'
network: 'wifi',
},
originalTimestamp: '2024-01-23T08:35:17.562Z',
sentAt: '2024-01-23T08:35:17.562Z',
Expand All @@ -58,20 +58,22 @@ export const data = [
JSON: {
ip: '192.11.22.33',
email: '[email protected]',
events: [{
type: 'track',
event: 'User Signed Up',
sent_at: '2024-01-23T08:35:17.562Z',
message_id: '84e26acc-56a5-4835-8233-591137fca468',
properties: {
email: '[email protected]',
label: 'test',
value: 10,
},
context: {
network: 'wifi'
events: [
{
type: 'track',
event: 'User Signed Up',
sent_at: '2024-01-23T08:35:17.562Z',
message_id: '84e26acc-56a5-4835-8233-591137fca468',
properties: {
email: '[email protected]',
label: 'test',
value: 10,
},
context: {
network: 'wifi',
},
},
}]
],
},
},
endpoint: 'https://api2.getkoala.com/web/projects/kkooaallaa321/batch',
Expand Down Expand Up @@ -127,7 +129,7 @@ export const data = [
postalCode: '94107',
},
email: '[email protected]',
ko_profile_id: 'xxxx-2222-xxxx-xxxx'
ko_profile_id: 'xxxx-2222-xxxx-xxxx',
},
originalTimestamp: '2024-01-23T08:35:17.342Z',
sentAt: '2024-01-23T08:35:35.234Z',
Expand All @@ -153,20 +155,22 @@ export const data = [
JSON: {
email: '[email protected]',
profile_id: 'xxxx-2222-xxxx-xxxx',
identifies: [{
type: 'identify',
sent_at: '2024-01-23T08:35:17.342Z',
traits: {
FirstName: 'John',
LastName: 'Doe',
address: {
city: 'San Francisco',
state: 'CA',
postalCode: '94107',
identifies: [
{
type: 'identify',
sent_at: '2024-01-23T08:35:17.342Z',
traits: {
FirstName: 'John',
LastName: 'Doe',
address: {
city: 'San Francisco',
state: 'CA',
postalCode: '94107',
},
email: '[email protected]',
},
email: '[email protected]',
},
}],
],
},
},
endpoint: 'https://api2.getkoala.com/web/projects/kkooaallaa321/batch',
Expand Down
88 changes: 46 additions & 42 deletions test/integrations/destinations/koala/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export const data = [
type: 'track',
messageId: '84e26acc-56a5-4835-8233-591137fca468',
traits: {
email: '[email protected]'
email: '[email protected]',
},
properties: {
label: 'test',
value: 10,
},
context: {
network: 'wifi'
network: 'wifi',
},
originalTimestamp: '2024-01-23T08:35:17.562Z',
sentAt: '2024-01-23T08:35:17.562Z',
Expand All @@ -44,8 +44,8 @@ export const data = [
jobId: 1,
userId: 'u1',
destinationId: 'destId',
workspaceId: 'wspId'
}
workspaceId: 'wspId',
},
},
{
destination: {
Expand All @@ -65,14 +65,14 @@ export const data = [
type: 'track',
messageId: '8bc79b03-2a5c-4615-b2da-54c0aaaaaae8',
traits: {
ko_profile_id: '123456'
ko_profile_id: '123456',
},
properties: {
attr1: 'foo',
attr2: 'bar'
attr2: 'bar',
},
context: {
network: 'wifi'
network: 'wifi',
},
originalTimestamp: '2024-01-23T08:35:17.562Z',
sentAt: '2024-01-23T08:35:17.562Z',
Expand All @@ -82,14 +82,14 @@ export const data = [
jobId: 2,
userId: 'u1',
destinationId: 'destId',
workspaceId: 'wspId'
}
workspaceId: 'wspId',
},
},
],
destType: 'koala',
},
method: 'POST'
}
method: 'POST',
},
},
output: {
response: {
Expand All @@ -105,19 +105,21 @@ export const data = [
JSON: {
ip: '192.11.22.33',
email: '[email protected]',
events: [{
type: 'track',
event: 'User Signed Up',
sent_at: '2024-01-23T08:35:17.562Z',
message_id: '84e26acc-56a5-4835-8233-591137fca468',
properties: {
label: 'test',
value: 10,
events: [
{
type: 'track',
event: 'User Signed Up',
sent_at: '2024-01-23T08:35:17.562Z',
message_id: '84e26acc-56a5-4835-8233-591137fca468',
properties: {
label: 'test',
value: 10,
},
context: {
network: 'wifi',
},
},
context: {
network: 'wifi'
},
}]
],
},
},
endpoint: 'https://api2.getkoala.com/web/projects/kkooaallaa321/batch',
Expand Down Expand Up @@ -153,19 +155,21 @@ export const data = [
JSON: {
ip: '192.11.55.1',
profile_id: '123456',
events: [{
type: 'track',
event: 'User Deleted account',
sent_at: '2024-01-23T08:35:17.562Z',
message_id: '8bc79b03-2a5c-4615-b2da-54c0aaaaaae8',
properties: {
attr1: 'foo',
attr2: 'bar'
},
context: {
network: 'wifi'
events: [
{
type: 'track',
event: 'User Deleted account',
sent_at: '2024-01-23T08:35:17.562Z',
message_id: '8bc79b03-2a5c-4615-b2da-54c0aaaaaae8',
properties: {
attr1: 'foo',
attr2: 'bar',
},
context: {
network: 'wifi',
},
},
}]
],
},
},
endpoint: 'https://api2.getkoala.com/web/projects/kkooaallaa321/batch',
Expand All @@ -191,10 +195,10 @@ export const data = [
},
},
},
}
]
}
}
}
}
]
},
],
},
},
},
},
];
23 changes: 21 additions & 2 deletions test/integrations/destinations/the_trade_desk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ const destTypeInUpperCase = 'THE_TRADE_DESK';
const advertiserId = 'test-advertiser-id';
const dataProviderId = 'rudderstack';
const segmentName = 'test-segment';

const trackerId = 'test-trackerId';
const firstPartyDataEndpoint = 'https://sin-data.adsrvr.org/data/advertiser';

const sampleDestination: Destination = {
Config: {
Expand Down Expand Up @@ -48,6 +47,22 @@ const sampleContext = {
sources: sampleSource,
};

const proxyV1AbortableErrorStatTags = {
destType: destTypeInUpperCase,
destinationId: 'default-destinationId',
errorCategory: 'network',
errorType: 'aborted',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
workspaceId: 'default-workspaceId',
};

const { errorType: _, ...proxyV1PlatformErrorStatTags } = proxyV1AbortableErrorStatTags;
proxyV1PlatformErrorStatTags.errorCategory = 'platform';

const proxyV1RetryableErrorStatTags = { ...proxyV1AbortableErrorStatTags, errorType: 'retryable' };

export {
destType,
destTypeInUpperCase,
Expand All @@ -56,4 +71,8 @@ export {
segmentName,
sampleDestination,
sampleContext,
proxyV1AbortableErrorStatTags,
proxyV1PlatformErrorStatTags,
proxyV1RetryableErrorStatTags,
firstPartyDataEndpoint,
};
Loading

0 comments on commit e43b83d

Please sign in to comment.