Skip to content

Commit

Permalink
Merge branch 'develop' into chore.update-gaec-api
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip authored Aug 27, 2024
2 parents c71fab8 + fc6bcf7 commit 0bf4dec
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ut-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ jobs:
--set gateway.image=rudderlabs/rudder-openfaas-gateway:0.25.2 \
--set faasnetes.image=rudderlabs/rudder-openfaas-faas-netes:0.15.4
- name: Create regcred secret in openfaas
run: kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=${{ secrets.DOCKERHUB_USERNAME }} --docker-password=${{ secrets.DOCKERHUB_TOKEN }} --docker-email=${{ secrets.DOCKERHUB_EMAIL }} -n openfaas

- name: Create regcred secret in openfaas-fn
run: kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=${{ secrets.DOCKERHUB_USERNAME }} --docker-password=${{ secrets.DOCKERHUB_TOKEN }} --docker-email=${{ secrets.DOCKERHUB_EMAIL }} -n openfaas-fn

- name: Patch default service account in openfaas-fn
run: 'kubectl patch serviceaccount default -n openfaas-fn -p ''{"imagePullSecrets": [{"name": "regcred"}]}'''

- name: Patch deployment "gateway"
run: 'kubectl patch deployment gateway -n openfaas -p ''{"spec": {"template": {"spec": {"imagePullSecrets": [{"name": "regcred"}]}}}}'''

- name: Wait for deployment "gateway" rollout
run: kubectl rollout status deploy/gateway --timeout 120s -n openfaas

Expand Down
13 changes: 9 additions & 4 deletions src/cdk/v2/destinations/the_trade_desk/transformRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const batchResponseBuilder = (items, config) => {
return response;
};

const checkNullUndefinedEmptyFields = (fields) =>
!!Object.entries(fields).some(([, value]) => !value);

const processRecordInputs = (inputs, destination) => {
const { Config } = destination;
const items = [];
Expand Down Expand Up @@ -68,6 +71,11 @@ const processRecordInputs = (inputs, destination) => {
return;
}

if (checkNullUndefinedEmptyFields(fields)) {
errorResponseList.push(handleRtTfSingleEventError(input, emptyFieldsError, {}));
return;
}

successMetadata.push(input.metadata);
const data = [
{
Expand All @@ -78,10 +86,7 @@ const processRecordInputs = (inputs, destination) => {

Object.keys(fields).forEach((id) => {
const value = fields[id];
if (value) {
// adding only non empty ID's
items.push({ [id]: value, Data: data });
}
items.push({ [id]: value, Data: data });
});
});

Expand Down
84 changes: 83 additions & 1 deletion test/integrations/destinations/the_trade_desk/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const data = [
action: 'insert',
fields: {
DAID: 'test-daid-2',
UID2: null,
UID2: 'test-uid2-2',
},
channel: 'sources',
context: sampleContext,
Expand Down Expand Up @@ -117,6 +117,35 @@ export const data = [
},
files: {},
},
{
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://sin-data.adsrvr.org/data/advertiser',
headers: {},
params: {},
body: {
JSON: {
DataProviderId: dataProviderId,
AdvertiserId: advertiserId,
Items: [
{
UID2: 'test-uid2-2',
Data: [
{
Name: segmentName,
TTLInMinutes: 43200,
},
],
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
},
],
metadata: [
{
Expand Down Expand Up @@ -727,6 +756,8 @@ export const data = [
action: 'insert',
fields: {
DAID: 'test-daid-1',
UID2: 'test-uid2-1',
EUID: 'test-euid-1',
},
channel: 'sources',
context: sampleContext,
Expand All @@ -737,6 +768,24 @@ export const data = [
jobId: 2,
},
},
{
message: {
type: 'record',
action: 'insert',
fields: {
DAID: 'test-daid-2',
UID2: null,
EUID: null,
},
channel: 'sources',
context: sampleContext,
recordId: '3',
},
destination: sampleDestination,
metadata: {
jobId: 3,
},
},
],
destType,
},
Expand Down Expand Up @@ -771,6 +820,24 @@ export const data = [
},
],
},
{
UID2: 'test-uid2-1',
Data: [
{
Name: segmentName,
TTLInMinutes: 43200,
},
],
},
{
EUID: 'test-euid-1',
Data: [
{
Name: segmentName,
TTLInMinutes: 43200,
},
],
},
],
},
JSON_ARRAY: {},
Expand Down Expand Up @@ -804,6 +871,21 @@ export const data = [
},
destination: sampleDestination,
},
{
batched: false,
metadata: [{ jobId: 3 }],
statusCode: 400,
error: '`fields` cannot be empty',
statTags: {
destType: destTypeInUpperCase,
implementation: 'cdkV2',
feature: 'router',
module: 'destination',
errorCategory: 'dataValidation',
errorType: 'instrumentation',
},
destination: sampleDestination,
},
],
},
},
Expand Down

0 comments on commit 0bf4dec

Please sign in to comment.