Skip to content

Commit

Permalink
Merge branch 'develop' into fix.hs-null-conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 committed Feb 27, 2024
2 parents 322a069 + 4be2997 commit ed7d559
Show file tree
Hide file tree
Showing 7 changed files with 607 additions and 206 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ See the project's [README](README.md) for further information about working in t
- Include instructions on how to test your changes.
3. Your branch may be merged once all configured checks pass, including:
- A review from appropriate maintainers
4. Along with the PR in transformer raise a PR against [config-generator][config-generator] with the configurations.

## Committing

Expand Down
2 changes: 1 addition & 1 deletion src/util/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class Prometheus {
name: 'shopify_anon_id_resolve',
help: 'shopify_anon_id_resolve',
type: 'counter',
labelNames: ['method', 'writeKey', 'shopifyTopic'],
labelNames: ['method', 'writeKey', 'shopifyTopic', 'source'],
},
{
name: 'shopify_redis_calls',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import { ProxyV1TestData } from '../../../testTypes';
import {
generateMetadata,
generateProxyV0Payload,
generateProxyV1Payload,
} from '../../../testUtils';

const commonHeaders = {
Authorization: 'Bearer abcd123',
'Content-Type': 'application/json',
'User-Agent': 'RudderLabs',
};

const commonRequestParameters = {
headers: commonHeaders,
JSON: {
users: [
{
schema: ['EMAIL_SHA256'],
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']],
},
],
},
};

export const businessV0TestScenarios = [
{
id: 'snapchat_custom_audience_v0_oauth_scenario_1',
name: 'snapchat_custom_audience',
description: '[Proxy v0 API] :: successfull call',
successCriteria: 'Proper response from destination is received',
scenario: 'Oauth',
feature: 'dataDelivery',
module: 'destination',
version: 'v0',
input: {
request: {
body: generateProxyV0Payload({
...commonRequestParameters,
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users',
params: {
destination: 'snapchat_custom_audience',
},
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 200,
message: 'Request Processed Successfully',
destinationResponse: {
response: {
request_status: 'SUCCESS',
request_id: '12345',
users: [
{
sub_request_status: 'SUCCESS',
user: {
number_uploaded_users: 1,
},
},
],
},
status: 200,
},
},
},
},
},
},
];

export const businessV1TestScenarios: ProxyV1TestData[] = [
{
id: 'snapchat_custom_audience_v1_oauth_scenario_1',
name: 'snapchat_custom_audience',
description: '[Proxy v1 API] :: successfull oauth',
successCriteria: 'Proper response from destination is received',
scenario: 'Oauth',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
...commonRequestParameters,
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users',
params: {
destination: 'snapchat_custom_audience',
},
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 200,
message: 'Request Processed Successfully',
response: [
{
error: `{\"request_status\":\"SUCCESS\",\"request_id\":\"12345\",\"users\":[{\"sub_request_status\":\"SUCCESS\",\"user\":{\"number_uploaded_users\":1}}]}`,
statusCode: 200,
metadata: generateMetadata(1),
},
],
},
},
},
},
},
];
Original file line number Diff line number Diff line change
@@ -1,206 +1,11 @@
import { businessV0TestScenarios, businessV1TestScenarios } from './business';
import { v0OauthScenarios, v1OauthScenarios } from './oauth';
import { otherScenariosV1 } from './other';

export const data = [
{
name: 'snapchat_custom_audience',
description: 'Test 0',
feature: 'dataDelivery',
module: 'destination',
version: 'v0',
input: {
request: {
body: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users',
headers: {
Authorization: 'Bearer abcd123',
'Content-Type': 'application/json',
},
body: {
JSON: {
users: [
{
schema: ['EMAIL_SHA256'],
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']],
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
params: {
destination: 'snapchat_custom_audience',
},
},
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 200,
message: 'Request Processed Successfully',
destinationResponse: {
response: {
request_status: 'SUCCESS',
request_id: '12345',
users: [
{
sub_request_status: 'SUCCESS',
user: {
number_uploaded_users: 1,
},
},
],
},
status: 200,
},
},
},
},
},
},
{
name: 'snapchat_custom_audience',
description: 'Test 1',
feature: 'dataDelivery',
module: 'destination',
version: 'v0',
input: {
request: {
body: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://adsapi.snapchat.com/v1/segments/456/users',
headers: {
Authorization: 'Bearer abcd123',
'Content-Type': 'application/json',
},
body: {
JSON: {
users: [
{
schema: ['EMAIL_SHA256'],
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']],
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
params: {
destination: 'snapchat_custom_audience',
},
},
method: 'POST',
},
},
output: {
response: {
status: 500,
body: {
output: {
status: 500,
destinationResponse: {
response: 'unauthorized',
status: 401,
},
message:
'Failed with unauthorized during snapchat_custom_audience response transformation',
statTags: {
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
errorCategory: 'network',
destinationId: 'Non-determininable',
workspaceId: 'Non-determininable',
errorType: 'retryable',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
},
authErrorCategory: 'REFRESH_TOKEN',
},
},
},
},
},
{
name: 'snapchat_custom_audience',
description: 'Test 2',
feature: 'dataDelivery',
module: 'destination',
version: 'v0',
input: {
request: {
body: {
version: '1',
type: 'REST',
method: 'DELETE',
endpoint: 'https://adsapi.snapchat.com/v1/segments/789/users',
headers: {
Authorization: 'Bearer abcd123',
'Content-Type': 'application/json',
},
body: {
JSON: {
users: [
{
id: '123456',
schema: ['EMAIL_SHA256'],
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']],
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
params: {
destination: 'snapchat_custom_audience',
},
},
method: 'POST',
},
},
output: {
response: {
status: 400,
body: {
output: {
authErrorCategory: 'AUTH_STATUS_INACTIVE',
status: 400,
destinationResponse: {
response: {
request_status: 'ERROR',
request_id: '98e2a602-3cf4-4596-a8f9-7f034161f89a',
debug_message: 'Caller does not have permission',
display_message:
"We're sorry, but the requested resource is not available at this time",
error_code: 'E3002',
},
status: 403,
},
message: 'undefined during snapchat_custom_audience response transformation',
statTags: {
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
errorCategory: 'network',
destinationId: 'Non-determininable',
workspaceId: 'Non-determininable',
errorType: 'aborted',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
},
},
},
},
},
},
...v0OauthScenarios,
...v1OauthScenarios,
...businessV0TestScenarios,
...businessV1TestScenarios,
...otherScenariosV1,
];

0 comments on commit ed7d559

Please sign in to comment.