--- policy: /ce/ca/aws/elb/load-balancer-idle logic: /ce/ca/aws/elb/load-balancer-idle/prod.logic.yaml executionTime: 2026-06-06T12:02:55.622206814Z generationMs: 49 executionMs: 871 rows: - id: '001' match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} - id: '002' match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__createdTime__c').withinLastDays(30) actual: extract('CA10__createdTime__c').withinLastDays(30) runtimeError: {} - id: '003' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0) actual: extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0) runtimeError: {} - id: '004' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0) actual: extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0) runtimeError: {} - id: '005' match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: '006' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0) actual: extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0) runtimeError: {} usedFiles: - path: /ce/ca/aws/elb/load-balancer-idle/policy.yaml md5Hash: E7BD34EC05D832C2316FB64382AB2675 content: "---\nnames:\n full: AWS ELB Application Load Balancer is idle\n contextual:\ \ Application Load Balancer is idle\ndescription: >\n Identify AWS Application\ \ Load Balancers (ALBs) that have received no requests \n over the last 30\ \ days. Idle ALBs incur costs without providing value and should \n be reviewed\ \ for deletion.\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n - \"COST\"\nframeworkMappings:\n\ \ - \"/frameworks/cloudaware/cost-efficiency-and-optimization/waste-reduction\"\ \nsimilarPolicies:\n cloudConformity:\n - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/ELB/idle-elastic-load-balancer.html\n\ \ name: Idle Elastic Load Balancer" - path: /ce/ca/aws/elb/load-balancer-idle/prod.logic.yaml md5Hash: E5C018A42611A9068226F5E97F672FC3 content: | --- inputType: "CA10__CaAwsLoadBalancer__c" recordTypes: - "caAwsLoadBalancerApplication" - "caAwsLoadBalancerClassic" importExtracts: - file: "/types/CA10__CaAwsLoadBalancer__c/object.extracts.yaml" testData: - file: "test-data.json" conditions: - status: "INAPPLICABLE" currentStateMessage: "This policy only applies to application and Classic load balancers." check: AND: args: - NOT_EQUAL: left: EXTRACT: "CA10__type__c" right: TEXT: "application" - NOT_EQUAL: left: EXTRACT: "CA10__type__c" right: TEXT: "classic" - status: "INAPPLICABLE" currentStateMessage: "The load balancer was created less than 30 days ago." check: IS_WITHIN_LAST_DAYS: offsetDays: 30 arg: EXTRACT: "CA10__createdTime__c" - status: "INCOMPLIANT" currentStateMessage: "The load balancer has received zero requests in the last 30 days." remediationMessage: "Review the idle load balancer and consider deleting it to reduce costs." check: OR: args: - IS_EMPTY: arg: EXTRACT: "CA10__requestCountOneMonth__c" - LESS_THAN_EQUAL: left: EXTRACT: "CA10__requestCountOneMonth__c" right: NUMBER: 0.0 otherwise: status: "COMPLIANT" currentStateMessage: "The load balancer is actively processing requests." - path: /ce/ca/aws/elb/load-balancer-idle/test-data.json md5Hash: A8054F8C017C9237707B5D9371EB59FB content: | [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-12-08T03:55:39Z" }, "CA10__disappearanceTime__c": "2025-12-06T06:53:02Z", "CA10__createdTime__c": "2025-12-05T22:50:57Z", "CA10__requestCountOneMonth__c": 5, "CA10__type__c": "application", "Id": "001", "RecordTypeId": "rt000", "RecordType": { "DeveloperName": "caAwsLoadBalancerApplication", "Id": "rt000" } }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "399", "conditionText": "extract('CA10__createdTime__c').withinLastDays(30)", "runtimeError": null }, "context": { "snapshotTime": "2025-12-08T03:55:39Z" }, "CA10__disappearanceTime__c": null, "CA10__createdTime__c": "2025-12-05T15:47:32Z", "CA10__requestCountOneMonth__c": 110, "CA10__type__c": "application", "Id": "002", "RecordTypeId": "rt000", "RecordType": { "DeveloperName": "caAwsLoadBalancerApplication", "Id": "rt000" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "499", "conditionText": "extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0)", "runtimeError": null }, "context": { "snapshotTime": "2025-12-08T03:55:39Z" }, "CA10__disappearanceTime__c": null, "CA10__createdTime__c": "2022-12-19T18:03:51Z", "CA10__requestCountOneMonth__c": null, "CA10__type__c": "application", "Id": "003", "RecordTypeId": "rt000", "RecordType": { "DeveloperName": "caAwsLoadBalancerApplication", "Id": "rt000" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "499", "conditionText": "extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0)", "runtimeError": null }, "context": { "snapshotTime": "2025-12-08T03:55:39Z" }, "CA10__disappearanceTime__c": null, "CA10__createdTime__c": "2022-12-19T18:03:51Z", "CA10__requestCountOneMonth__c": 0, "CA10__type__c": "application", "Id": "004", "RecordTypeId": "rt000", "RecordType": { "DeveloperName": "caAwsLoadBalancerApplication", "Id": "rt000" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-12-08T03:55:39Z" }, "CA10__disappearanceTime__c": null, "CA10__createdTime__c": "2022-12-19T17:37:45Z", "CA10__requestCountOneMonth__c": 1, "CA10__type__c": "application", "Id": "005", "RecordTypeId": "rt000", "RecordType": { "DeveloperName": "caAwsLoadBalancerApplication", "Id": "rt000" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "499", "conditionText": "extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0)", "runtimeError": null }, "context": { "snapshotTime": "2025-12-08T03:55:39Z" }, "CA10__disappearanceTime__c": null, "CA10__createdTime__c": "2022-12-19T17:37:45Z", "CA10__requestCountOneMonth__c": 0, "CA10__type__c": "classic", "Id": "006", "RecordTypeId": "rt000", "RecordType": { "DeveloperName": "caAwsLoadBalancerClassic", "Id": "rt000" } } ] - path: /types/CA10__CaAwsLoadBalancer__c/object.extracts.yaml md5Hash: 9895F1EB30DFD8DDB6D571F452C5A7DE content: "---\nextracts:\n # The subnets for the load balancer.\n # Type: Array\ \ of AvailabilityZone objects\n # Required: No\n # \n # apparently it could\ \ be empty according to documentation, but I don't believe so and can't find\ \ any LB without AZs\n - name: CA10__availabilityZones__c\n value: \n \ \ FIELD:\n path: CA10__availabilityZones__c\n undeterminedIf:\n\ \ isEmpty: Corrupted data. Availability zones should always present\n\ \ - name: caSetFrom_availabilityZones__c\n value: \n SET_FROM:\n \ \ separator: \"\\n\"\n arg:\n EXTRACT: CA10__availabilityZones__c\n\ # Checkbox for Classic load balancer record type.\n - name: CA10__crossZoneLoadBalancing__c\n\ \ value: \n FIELD:\n path: CA10__crossZoneLoadBalancing__c\n\ # Values: classic | application | network | gateway. Not nullable\n - name:\ \ CA10__type__c\n value: \n FIELD:\n path: CA10__type__c\n \ \ undeterminedIf:\n isEmpty: \"Corrupted data. Load Balancer Type\ \ cannot be empty.\"\n - name: CA10__additionalAttributes__c\n value: \n\ \ FIELD:\n path: CA10__additionalAttributes__c\n - name: caSetFrom_additionalAttributes__c\n\ \ value: \n SET_FROM:\n separator: \"\\n\"\n arg:\n \ \ EXTRACT: CA10__additionalAttributes__c\n# Checkbox.\n - name: CA10__accessLogsEnabled__c\n\ \ value: \n FIELD:\n path: CA10__accessLogsEnabled__c\n# Number.\n\ \ - name: CA10__requestCountOneMonth__c\n value: \n FIELD:\n \ \ path: CA10__requestCountOneMonth__c\n# Date/Time.\n - name: CA10__createdTime__c\n\ \ value: \n FIELD:\n path: CA10__createdTime__c\n# Checkbox.\n\ \ - name: CA10__connectionDrainingEnabled__c\n value: \n FIELD:\n \ \ path: CA10__connectionDrainingEnabled__c\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "001", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "002", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "399", "conditionText" : "extract('CA10__createdTime__c').withinLastDays(30)", "runtimeError" : null } }, { "Id" : "003", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "499", "conditionText" : "extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0)", "runtimeError" : null } }, { "Id" : "004", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "499", "conditionText" : "extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0)", "runtimeError" : null } }, { "Id" : "005", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "006", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "499", "conditionText" : "extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0)", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsLoadBalancer__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-12-08T03:55:39Z") }, "CA10__disappearanceTime__c" : new Date("2025-12-06T06:53:02Z"), "CA10__type__c" : "application", "CA10__createdTime__c" : new Date("2025-12-05T22:50:57Z"), "CA10__requestCountOneMonth__c" : 5, "Id" : "001", "RecordTypeId" : "rt000" }, { "context" : { "snapshotTime" : new Date("2025-12-08T03:55:39Z") }, "CA10__type__c" : "application", "CA10__createdTime__c" : new Date("2025-12-05T15:47:32Z"), "CA10__requestCountOneMonth__c" : 110, "Id" : "002", "RecordTypeId" : "rt000" }, { "context" : { "snapshotTime" : new Date("2025-12-08T03:55:39Z") }, "CA10__type__c" : "application", "CA10__createdTime__c" : new Date("2022-12-19T18:03:51Z"), "CA10__requestCountOneMonth__c" : null, "Id" : "003", "RecordTypeId" : "rt000" }, { "context" : { "snapshotTime" : new Date("2025-12-08T03:55:39Z") }, "CA10__type__c" : "application", "CA10__createdTime__c" : new Date("2022-12-19T18:03:51Z"), "CA10__requestCountOneMonth__c" : 0, "Id" : "004", "RecordTypeId" : "rt000" }, { "context" : { "snapshotTime" : new Date("2025-12-08T03:55:39Z") }, "CA10__type__c" : "application", "CA10__createdTime__c" : new Date("2022-12-19T17:37:45Z"), "CA10__requestCountOneMonth__c" : 1, "Id" : "005", "RecordTypeId" : "rt000" }, { "context" : { "snapshotTime" : new Date("2025-12-08T03:55:39Z") }, "CA10__type__c" : "classic", "CA10__createdTime__c" : new Date("2022-12-19T17:37:45Z"), "CA10__requestCountOneMonth__c" : 0, "Id" : "006", "RecordTypeId" : "rt000" } ]; """; CREATE TEMP FUNCTION mock_RecordType() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-12-08T03:55:39Z") }, "DeveloperName" : "caAwsLoadBalancerClassic", "Id" : "rt000" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsLoadBalancer__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, RecordType STRUCT< DeveloperName STRING, Id STRING >, CA10__type__c STRING, CA10__createdTime__c TIMESTAMP, CA10__requestCountOneMonth__c FLOAT64, Id STRING, RecordTypeId STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var CollectionLib = new function () { this.parse = function(arg, separator, skipEmpty, skipDuplicates, sort, normalize) { if (arg == null) return []; let parts = arg.split(separator); return this.fromArray(parts, skipEmpty, skipDuplicates, sort, normalize); }; this.fromArray = function(arr, skipEmpty, skipDuplicates, sort, normalize) { if (arr == null) return []; let result = []; let seen = new Set(); arr.forEach(el => { let normalized = normalize ? TextLib.normalize(el) : BytesLib.normalize(el); if (!skipEmpty || (normalize ? TextLib.isNotEmpty(el) : BytesLib.isNotEmpty(el))) { if (!skipDuplicates || !seen.has(normalized)) { if (skipDuplicates) seen.add(normalized); result.push(normalized); } } }); if (sort) result.sort(); return result; }; this.equal = function(left, right) { left = left == null ? [] : left; right = right == null ? [] : right; if (left.length !== right.length) return false; for (let i = 0; i < left.length; i++) { if (left[i] !== right[i]) return false; } return true; }; this.notEqual = function(left, right) { return !this.equal(left, right); }; this.size = function(collection) { return collection == null ? 0 : collection.length; }; this.startsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[0] === normalizedSearch; }; this.endsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[collection.length - 1] === normalizedSearch; }; this.contains = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; return collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)); }; this.containsAll = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.every(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; this.containsAny = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.some(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; }(); var BytesLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg; }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var IsEmptyLib = new function () { this.simpleIsEmpty = function(arg) { return arg == null; }; this.simpleIsNotEmpty = function(arg) { return arg != null; }; }(); var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var todayMinus30Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (-30 * 86400000); var todayPlus1Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (1 * 86400000); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] references1.push('Record Type Name [obj.RecordType.DeveloperName]: ' + obj.RecordType.DeveloperName); if (!CollectionLib.contains(CollectionLib.fromArray(['caAwsLoadBalancerApplication', 'caAwsLoadBalancerClassic'], true, true, true, true), obj.RecordType.DeveloperName, true)) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "not(setOfText(['caAwsLoadBalancerApplication', 'caAwsLoadBalancerClassic']).contains(RecordType.DeveloperName))", currentStateMessage: "Object record type is not applicable", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function fieldChecked5() { if (TextLib.isEmpty(obj.CA10__type__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__type__c.isEmpty()", currentStateMessage: "Corrupted data. Load Balancer Type cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__type__c; } function extract4() { if (!this.out) { this.out = fieldChecked5(); } return this.out; }; references1.push('Type [obj.CA10__type__c]: ' + obj.CA10__type__c); try { if (TextLib.notEqual(extract4.call(extract4), 'application') && TextLib.notEqual(extract4.call(extract4), 'classic')) { return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "extract('CA10__type__c') != 'application' && extract('CA10__type__c') != 'classic'", currentStateMessage: "This policy only applies to application and Classic load balancers.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[3], conditionIndex:[300..399] function extract8() { if (!this.out) { this.out = obj.CA10__createdTime__c; } return this.out; }; references1.push('Created Time [obj.CA10__createdTime__c]: ' + obj.CA10__createdTime__c); if (extract8.call(extract8) != null && extract8.call(extract8).getTime() >= todayMinus30Day && extract8.call(extract8).getTime() < todayPlus1Day) { return {status: 'INAPPLICABLE', conditionIndex: 399, conditionText: "extract('CA10__createdTime__c').withinLastDays(30)", currentStateMessage: "The load balancer was created less than 30 days ago.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[4], conditionIndex:[400..499] function extract12() { if (!this.out) { this.out = obj.CA10__requestCountOneMonth__c; } return this.out; }; references1.push('1-Month Request Count [obj.CA10__requestCountOneMonth__c]: ' + obj.CA10__requestCountOneMonth__c); if (IsEmptyLib.simpleIsEmpty(extract12.call(extract12)) || (extract12.call(extract12) != null && 0.0 != null && extract12.call(extract12) <= 0.0)) { return {status: 'INCOMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__requestCountOneMonth__c').isEmpty() || extract('CA10__requestCountOneMonth__c') <= number(0.0)", currentStateMessage: "The load balancer has received zero requests in the last 30 days.", currentStateReferences: references1.join('\n'), remediation: "Review the idle load balancer and consider deleting it to reduce costs.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "The load balancer is actively processing requests.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; SELECT expectedResult.Id as Id, IF ( IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '') AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1) AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '') AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''), "MATCH", "FAIL" ) as match, expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus, expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex, expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText, expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError FROM UNNEST(mock_ExpectedResult()) expectedResult LEFT JOIN ( SELECT sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, STRUCT ( `RecordType`.DeveloperName AS DeveloperName, `RecordType`.Id AS Id ) AS RecordType, sObject.CA10__type__c AS CA10__type__c, sObject.CA10__createdTime__c AS CA10__createdTime__c, sObject.CA10__requestCountOneMonth__c AS CA10__requestCountOneMonth__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, process_CA10__CaAwsLoadBalancer__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, STRUCT ( `RecordType`.DeveloperName AS DeveloperName, `RecordType`.Id AS Id ) AS RecordType, sObject.CA10__type__c AS CA10__type__c, sObject.CA10__createdTime__c AS CA10__createdTime__c, sObject.CA10__requestCountOneMonth__c AS CA10__requestCountOneMonth__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsLoadBalancer__c()) AS sObject LEFT JOIN UNNEST(mock_RecordType()) AS `RecordType` ON sObject.RecordTypeId = `RecordType`.Id ) sObject ON sObject.Id = expectedResult.Id;