From 3e09830275df097f8984442c4f2c8100d9167450 Mon Sep 17 00:00:00 2001 From: Yuliia Likhytska Date: Tue, 11 Jul 2023 22:23:59 +0200 Subject: [PATCH] #38: revert --- ...stExisting_automation.automation-meta.json | 2 +- .../testNew_automation.automation-meta.json | 2 +- .../query/testExisting_query.query-meta.json | 2 +- .../query/testNew_query1.query-meta.json} | 6 ++--- ...meta.sql => testNew_query1.query-meta.sql} | 0 .../9999999/automation/build-expected.json | 2 +- .../9999999/automation/create-expected.json | 2 +- .../9999999/automation/retrieve-expected.json | 2 +- ...trieve-testExisting_automation-expected.md | 26 +++++++++---------- .../9999999/automation/template-expected.json | 2 +- .../9999999/automation/update-expected.json | 2 +- ...update-testExisting_automation-expected.md | 23 ++++++++-------- .../get-response.json | 2 +- .../patch-response.json | 2 +- .../automation/v1/queries/get-response.json | 19 +++++++++++++- .../9999999/query/build-expected.json | 2 +- .../resources/9999999/query/get-expected.json | 2 +- .../9999999/query/patch-expected.json | 2 +- .../9999999/query/patch1-expected.sql | 6 ----- .../9999999/query/template-expected.json | 2 +- test/type.query.test.js | 12 ++++++--- 21 files changed, 69 insertions(+), 51 deletions(-) rename test/{resources/9999999/query/patch1-expected.json => mockRoot/deploy/testInstance/testBU/query/testNew_query1.query-meta.json} (68%) rename test/mockRoot/deploy/testInstance/testBU/query/{testExisting_query_fixKeys.query-meta.sql => testNew_query1.query-meta.sql} (100%) delete mode 100644 test/resources/9999999/query/patch1-expected.sql diff --git a/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json b/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json index 51f7c3efd..0110ca3e6 100644 --- a/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json +++ b/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json @@ -30,7 +30,7 @@ "r__type": "importFile" }, { - "name": "testExisting_query1", + "name": "testExisting_query", "r__type": "query" }, { diff --git a/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json b/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json index 850ec8a24..715b69f27 100644 --- a/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json +++ b/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json @@ -30,7 +30,7 @@ "r__type": "importFile" }, { - "name": "testExisting_query1", + "name": "testExisting_query", "r__type": "query" }, { diff --git a/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query.query-meta.json b/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query.query-meta.json index 86a4a393c..421e918e5 100644 --- a/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query.query-meta.json +++ b/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query.query-meta.json @@ -1,5 +1,5 @@ { - "name": "testExisting_query1", + "name": "testExisting_query", "key": "testExisting_query", "description": "updated on deploy", "targetKey": "testExisting_dataExtension", diff --git a/test/resources/9999999/query/patch1-expected.json b/test/mockRoot/deploy/testInstance/testBU/query/testNew_query1.query-meta.json similarity index 68% rename from test/resources/9999999/query/patch1-expected.json rename to test/mockRoot/deploy/testInstance/testBU/query/testNew_query1.query-meta.json index 86a4a393c..c29f18dc3 100644 --- a/test/resources/9999999/query/patch1-expected.json +++ b/test/mockRoot/deploy/testInstance/testBU/query/testNew_query1.query-meta.json @@ -1,7 +1,7 @@ { - "name": "testExisting_query1", - "key": "testExisting_query", - "description": "updated on deploy", + "name": "updateMePlease", + "key": "testNew_query1", + "description": "created on deploy", "targetKey": "testExisting_dataExtension", "createdDate": "2022-04-26T15:21:16.453", "modifiedDate": "2022-04-26T16:04:15.88", diff --git a/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.sql b/test/mockRoot/deploy/testInstance/testBU/query/testNew_query1.query-meta.sql similarity index 100% rename from test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.sql rename to test/mockRoot/deploy/testInstance/testBU/query/testNew_query1.query-meta.sql diff --git a/test/resources/9999999/automation/build-expected.json b/test/resources/9999999/automation/build-expected.json index d8c32fd40..87301aa55 100644 --- a/test/resources/9999999/automation/build-expected.json +++ b/test/resources/9999999/automation/build-expected.json @@ -30,7 +30,7 @@ "r__type": "importFile" }, { - "name": "testTemplated_query1", + "name": "testTemplated_query", "r__type": "query" }, { diff --git a/test/resources/9999999/automation/create-expected.json b/test/resources/9999999/automation/create-expected.json index 9e40f520d..92ea826e1 100644 --- a/test/resources/9999999/automation/create-expected.json +++ b/test/resources/9999999/automation/create-expected.json @@ -31,7 +31,7 @@ "r__type": "importFile" }, { - "name": "testExisting_query1", + "name": "testExisting_query", "r__type": "query" }, { diff --git a/test/resources/9999999/automation/retrieve-expected.json b/test/resources/9999999/automation/retrieve-expected.json index 55a7c1767..f4771678a 100644 --- a/test/resources/9999999/automation/retrieve-expected.json +++ b/test/resources/9999999/automation/retrieve-expected.json @@ -30,7 +30,7 @@ "r__type": "importFile" }, { - "name": "testExisting_query1", + "name": "testExisting_query", "r__type": "query" }, { diff --git a/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md b/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md index 8f4d2396b..22bd4c500 100644 --- a/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +++ b/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md @@ -10,21 +10,21 @@ **Schedule:** -- Start: 2022-07-30 00:00:00 +01:00 -- End: 2022-07-30 00:00:00 +01:00 -- Timezone: W. Europe Standard Time -- Recurrance: every day for 1 times +* Start: 2022-07-30 00:00:00 +01:00 +* End: 2022-07-30 00:00:00 +01:00 +* Timezone: W. Europe Standard Time +* Recurrance: every day for 1 times **Notifications:** -- Complete: complete@test.accenture.com -- Error: error@test.accenture.com ("test") +* Complete: complete@test.accenture.com +* Error: error@test.accenture.com ("test") -| Step 1
_-_ | -| ------------------------------------------------ | -| _1.1: dataExtract_
testExisting_dataExtract | -| _1.2: emailSend_
testExisting_emailSend | +| Step 1
_-_ | +| --- | +| _1.1: dataExtract_
testExisting_dataExtract | +| _1.2: emailSend_
testExisting_emailSend | | _1.3: fileTransfer_
testExisting_fileTransfer | -| _1.4: importFile_
testExisting_importFile | -| _1.5: query_
testExisting_query1 | -| _1.6: script_
testExisting_script | +| _1.4: importFile_
testExisting_importFile | +| _1.5: query_
testExisting_query | +| _1.6: script_
testExisting_script | diff --git a/test/resources/9999999/automation/template-expected.json b/test/resources/9999999/automation/template-expected.json index c82ba388b..32a6bcbc5 100644 --- a/test/resources/9999999/automation/template-expected.json +++ b/test/resources/9999999/automation/template-expected.json @@ -30,7 +30,7 @@ "r__type": "importFile" }, { - "name": "{{{prefix}}}query1", + "name": "{{{prefix}}}query", "r__type": "query" }, { diff --git a/test/resources/9999999/automation/update-expected.json b/test/resources/9999999/automation/update-expected.json index 6ba9e73b8..0705285b5 100644 --- a/test/resources/9999999/automation/update-expected.json +++ b/test/resources/9999999/automation/update-expected.json @@ -30,7 +30,7 @@ "r__type": "importFile" }, { - "name": "testExisting_query1", + "name": "testExisting_query", "r__type": "query" }, { diff --git a/test/resources/9999999/automation/update-testExisting_automation-expected.md b/test/resources/9999999/automation/update-testExisting_automation-expected.md index a18e49e0f..681c2a694 100644 --- a/test/resources/9999999/automation/update-testExisting_automation-expected.md +++ b/test/resources/9999999/automation/update-testExisting_automation-expected.md @@ -10,18 +10,19 @@ **Schedule:** -- Start: 2022-07-30 00:00:00 +01:00 -- End: 2022-07-30 00:00:00 +01:00 -- Timezone: W. Europe Standard Time -- Recurrance: every day for 1 times +* Start: 2022-07-30 00:00:00 +01:00 +* End: 2022-07-30 00:00:00 +01:00 +* Timezone: W. Europe Standard Time +* Recurrance: every day for 1 times **Notifications:** _none_ -| Step 1
_-_ | -| ------------------------------------------------ | -| _1.1: dataExtract_
testExisting_dataExtract | -| _1.2: emailSend_
testExisting_emailSend | + +| Step 1
_-_ | +| --- | +| _1.1: dataExtract_
testExisting_dataExtract | +| _1.2: emailSend_
testExisting_emailSend | | _1.3: fileTransfer_
testExisting_fileTransfer | -| _1.4: importFile_
testExisting_importFile | -| _1.5: query_
testExisting_query1 | -| _1.6: script_
testExisting_script | +| _1.4: importFile_
testExisting_importFile | +| _1.5: query_
testExisting_query | +| _1.6: script_
testExisting_script | diff --git a/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json b/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json index fff3e1592..9144d0e0b 100644 --- a/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json +++ b/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json @@ -1,6 +1,6 @@ { "queryDefinitionId": "549f0568-607c-4940-afef-437965094dat", - "name": "testExisting_query1", + "name": "testExisting_query", "key": "testExisting_query", "description": "bla bla", "queryText": "SELECT\n SubscriberKey as testField\nFROM\n _Subscribers\nWHERE\n country IN ('test')\n", diff --git a/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json b/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json index 8433390a8..6414f11dc 100644 --- a/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json +++ b/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json @@ -1,6 +1,6 @@ { "queryDefinitionId": "549f0568-607c-4940-afef-437965094dat", - "name": "testExisting_query1", + "name": "testExisting_query", "key": "testExisting_query", "description": "updated on deploy", "queryText": "SELECT\n SubscriberKey as testField\nFROM\n _Subscribers\nWHERE\n country IN ('test')\n", diff --git a/test/resources/9999999/automation/v1/queries/get-response.json b/test/resources/9999999/automation/v1/queries/get-response.json index 39ee926c5..31305c1f3 100644 --- a/test/resources/9999999/automation/v1/queries/get-response.json +++ b/test/resources/9999999/automation/v1/queries/get-response.json @@ -5,7 +5,7 @@ "items": [ { "queryDefinitionId": "549f0568-607c-4940-afef-437965094dat", - "name": "testExisting_query1", + "name": "testExisting_query", "key": "testExisting_query", "description": "bla bla", "queryText": "SELECT\n SubscriberKey as testField\nFROM\n _Subscribers\nWHERE\n country IN ('test')\n", @@ -36,6 +36,23 @@ "targetUpdateTypeName": "Overwrite", "categoryId": 999, "isFrozen": false + }, + { + "queryDefinitionId": "b28a1c2f-6656-478a-be51-4f12be4c9088", + "name": "updateMePlease", + "key": "testNew_query1", + "description": "bla bla", + "queryText": "SELECT\n SubscriberKey as testField\nFROM\n _Subscribers\nWHERE\n country IN ('test')\n", + "targetName": "testExisting_dataExtension", + "targetKey": "testExisting_dataExtension-WRONG", + "targetId": "21711373-72c1-ec11-b83b-48df37d1deb7", + "targetDescription": "", + "createdDate": "2022-04-26T15:21:16.453", + "modifiedDate": "2022-04-26T16:02:44.01", + "targetUpdateTypeId": 0, + "targetUpdateTypeName": "Overwrite", + "categoryId": 999, + "isFrozen": false } ] } diff --git a/test/resources/9999999/query/build-expected.json b/test/resources/9999999/query/build-expected.json index 72c92e729..a7df67267 100644 --- a/test/resources/9999999/query/build-expected.json +++ b/test/resources/9999999/query/build-expected.json @@ -1,5 +1,5 @@ { - "name": "testTemplated_query1", + "name": "testTemplated_query", "key": "testTemplated_query", "description": "foobar", "targetKey": "testTemplated_dataExtension", diff --git a/test/resources/9999999/query/get-expected.json b/test/resources/9999999/query/get-expected.json index e5571691e..4cd606716 100644 --- a/test/resources/9999999/query/get-expected.json +++ b/test/resources/9999999/query/get-expected.json @@ -1,5 +1,5 @@ { - "name": "testExisting_query1", + "name": "testExisting_query", "key": "testExisting_query", "description": "bla bla", "targetKey": "testExisting_dataExtension", diff --git a/test/resources/9999999/query/patch-expected.json b/test/resources/9999999/query/patch-expected.json index 86a4a393c..421e918e5 100644 --- a/test/resources/9999999/query/patch-expected.json +++ b/test/resources/9999999/query/patch-expected.json @@ -1,5 +1,5 @@ { - "name": "testExisting_query1", + "name": "testExisting_query", "key": "testExisting_query", "description": "updated on deploy", "targetKey": "testExisting_dataExtension", diff --git a/test/resources/9999999/query/patch1-expected.sql b/test/resources/9999999/query/patch1-expected.sql deleted file mode 100644 index 2a32f5fad..000000000 --- a/test/resources/9999999/query/patch1-expected.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT - SubscriberKey AS testField -FROM - _Subscribers -WHERE - country IN ('test') diff --git a/test/resources/9999999/query/template-expected.json b/test/resources/9999999/query/template-expected.json index 3f6caf4a6..9f9bd2806 100644 --- a/test/resources/9999999/query/template-expected.json +++ b/test/resources/9999999/query/template-expected.json @@ -1,5 +1,5 @@ { - "name": "{{{prefix}}}query1", + "name": "{{{prefix}}}query", "key": "{{{prefix}}}query", "description": "{{{description}}}", "targetKey": "{{{prefix}}}dataExtension", diff --git a/test/type.query.test.js b/test/type.query.test.js index 20d14c26f..b04579c57 100644 --- a/test/type.query.test.js +++ b/test/type.query.test.js @@ -27,7 +27,7 @@ describe('type: query', () => { const result = cache.getCache(); assert.equal( result.query ? Object.keys(result.query).length : 0, - 2, + 3, 'only two queries expected' ); // normal test @@ -142,14 +142,18 @@ describe('type: query', () => { }); it('Should create & upsert a query', async () => { // WHEN - await handler.deploy('testInstance/testBU', ['query']); + await handler.deploy( + 'testInstance/testBU', + ['query'], + ['testNew_query', 'testExisting_query'] + ); // THEN assert.equal(process.exitCode, false, 'deploy should not have thrown an error'); // get results from cache const result = cache.getCache(); assert.equal( result.query ? Object.keys(result.query).length : 0, - 3, + 4, 'three queries expected' ); // confirm created item @@ -183,6 +187,7 @@ describe('type: query', () => { handler.setOptions({ execute: true }); // WHEN await handler.deploy('testInstance/testBU', ['query']); + await handler.deploy('testInstance/testBU', ['query']); // THEN assert.equal( process.exitCode, @@ -214,6 +219,7 @@ describe('type: query', () => { 'testInstance/testBU', 'query', ['testExisting_query'], + ['testExisting_query'], 'testSourceMarket' ); // WHEN