diff --git a/sdk/synapse/synapse-spark/karma.conf.js b/sdk/synapse/synapse-spark/karma.conf.js index e93dbd46c059..dde624bf408b 100644 --- a/sdk/synapse/synapse-spark/karma.conf.js +++ b/sdk/synapse/synapse-spark/karma.conf.js @@ -4,12 +4,8 @@ // https://github.com/karma-runner/karma-chrome-launcher process.env.CHROME_BIN = require("puppeteer").executablePath(); require("dotenv").config(); -const { - jsonRecordingFilterFunction, - isPlaybackMode, - isSoftRecordMode, - isRecordMode -} = require("@azure-tools/test-recorder"); +const { relativeRecordingsPath } = require("@azure-tools/test-recorder"); +process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); module.exports = function(config) { config.set({ @@ -31,16 +27,14 @@ module.exports = function(config) { "karma-coverage", "karma-sourcemap-loader", "karma-junit-reporter", - "karma-json-to-file-reporter", - "karma-source-map-support", - "karma-json-preprocessor" + "karma-source-map-support" ], // list of files / patterns to load in the browser files: [ "dist-test/index.browser.js", { pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true } - ].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []), + ], // list of files / patterns to exclude exclude: [], @@ -48,8 +42,7 @@ module.exports = function(config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { - "**/*.js": ["sourcemap", "env"], - "recordings/browsers/**/*.json": ["json"] + "**/*.js": ["sourcemap", "env"] // IMPORTANT: COMMENT following line if you want to debug in your browsers!! // Preprocess source file to calculate code coverage, however this will make source file unreadable // "dist-test/index.js": ["coverage"] @@ -60,13 +53,14 @@ module.exports = function(config) { "ENDPOINT", "AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET", - "AZURE_TENANT_ID" + "AZURE_TENANT_ID", + "RECORDINGS_RELATIVE_PATH" ], // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ["mocha", "coverage", "junit", "json-to-file"], + reporters: ["mocha", "coverage", "junit"], coverageReporter: { // specify a common output directory @@ -89,11 +83,6 @@ module.exports = function(config) { properties: {} // key value pair of properties to add to the section of the report }, - jsonToFileReporter: { - filter: jsonRecordingFilterFunction, - outputPath: "." - }, - // web server port port: 9876, @@ -128,9 +117,6 @@ module.exports = function(config) { browserNoActivityTimeout: 60000000, browserDisconnectTimeout: 10000, browserDisconnectTolerance: 3, - browserConsoleLogOptions: { - terminal: !isRecordMode() - }, client: { mocha: { diff --git a/sdk/synapse/synapse-spark/package.json b/sdk/synapse/synapse-spark/package.json index 4e740c26d4b9..73da4429fd3d 100644 --- a/sdk/synapse/synapse-spark/package.json +++ b/sdk/synapse/synapse-spark/package.json @@ -32,9 +32,9 @@ "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", "@microsoft/api-extractor": "^7.31.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-credential": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", "@azure/test-utils": "^1.0.0", - "@azure/identity": "^2.0.1", "@types/chai": "^4.1.6", "@types/chai-as-promised": "^7.1.0", "@types/mocha": "^7.0.2", @@ -50,8 +50,6 @@ "karma-env-preprocessor": "^0.1.1", "karma-firefox-launcher": "^1.1.0", "karma-ie-launcher": "^1.0.0", - "karma-json-preprocessor": "^0.3.3", - "karma-json-to-file-reporter": "^1.0.1", "karma-junit-reporter": "^2.0.1", "karma-mocha": "^2.0.1", "karma-mocha-reporter": "^2.2.5", @@ -107,8 +105,8 @@ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser", "test:node": "npm run clean && npm run build:test && npm run unit-test:node", "test": "npm run clean && npm run build:test && npm run unit-test", - "unit-test:browser": "karma start --single-run", - "unit-test:node": "mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}*.spec.ts\"", + "unit-test:browser": "dev-tool run test:browser", + "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'", "unit-test": "npm run unit-test:node && npm run unit-test:browser", "extract-api": "api-extractor run --local", "clean": "rimraf dist dist-* temp types *.tgz *.log", diff --git a/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_create_session.json b/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_create_session.json index cbadbd68e37d..1f0c1c1136df 100644 --- a/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_create_session.json +++ b/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_create_session.json @@ -1,63 +1,69 @@ { - "recordings": [ - { - "method": "POST", - "url": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token", - "query": {}, - "requestBody": "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fsanitized%2F", - "status": 200, - "response": "{\"token_type\":\"Bearer\",\"expires_in\":86399,\"ext_expires_in\":86399,\"access_token\":\"access_token\"}", - "responseHeaders": { - "cache-control": "no-store, no-cache", - "content-length": "1322", - "content-type": "application/json; charset=utf-8", - "date": "Tue, 10 Aug 2021 20:26:28 GMT", - "expires": "-1", - "nel": "{\"report_to\":\"network-errors\",\"max_age\":86400,\"success_fraction\":0.001,\"failure_fraction\":1.0}", - "p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"", - "pragma": "no-cache", - "referrer-policy": "strict-origin-when-cross-origin", - "report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://identity.nel.measure.office.net/api/report?catId=GW+estsfd+san\"}]}", - "strict-transport-security": "max-age=31536000; includeSubDomains", - "x-content-type-options": "nosniff", - "x-ms-ests-server": "2.1.11935.14 - WUS2 ProdSlices", - "x-ms-request-id": "12c15834-6ab7-4523-adbb-b82b49240700" - } - }, - { - "method": "POST", - "url": "https://testaccount.dev.azuresynapse.net/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions", - "query": {}, - "requestBody": "{\"name\":\"demo_session\",\"driverMemory\":\"28g\",\"driverCores\":4,\"executorMemory\":\"28g\",\"executorCores\":4,\"numExecutors\":2}", - "status": 200, - "response": "{\"id\":34,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null}", - "responseHeaders": { - "content-type": "application/json; charset=utf-8", - "date": "Tue, 10 Aug 2021 20:26:33 GMT", - "server": "Kestrel Microsoft-HTTPAPI/2.0", - "status": "200", - "strict-transport-security": "max-age=31536000; includeSubDomains", - "x-ms-activity-id": "918a36bf-893e-4dd5-9633-e865b1486611", - "x-ms-client-request-id": "f9e6da3c-d1fc-47df-8db8-69422507ec63", - "x-ms-job-clusterrequested-on": "1/1/0001 12:00:00 AM +00:00", - "x-ms-job-ended-on": "", - "x-ms-job-internal-id": "34", - "x-ms-job-livysubmission-on": "1/1/0001 12:00:00 AM +00:00", - "x-ms-job-queued-on": "1/1/0001 12:00:00 AM +00:00", - "x-ms-job-result": "Uncertain", - "x-ms-job-scheduled-on": "1/1/0001 12:00:00 AM +00:00", - "x-ms-job-scheduler-state": "Queued", - "x-ms-job-submitted-by-name": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", - "x-ms-job-submitted-on": "8/10/2021 8:26:28 PM +00:00", - "x-ms-job-type": "SparkServiceSession", - "x-ms-request-id": "42694739-2907-4eb1-b12c-7549c42cd590", - "x-ms-response-time-ms": "4775" - } - } - ], - "uniqueTestInfo": { - "uniqueName": {}, - "newDate": {} - }, - "hash": "d4891a2317e662f176d144aef652b5ab" -} \ No newline at end of file + "Entries": [ + { + "RequestUri": "https://testaccount.dev.azuresynapse.net/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Content-Length": "118", + "Content-Type": "application/json", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/109.0.5412.0 Safari/537.36", + "x-ms-client-request-id": "bd635d4e-cf55-4a30-aa3c-283d8a1efb69", + "x-ms-useragent": "azsdk-js-synapse-spark/1.0.0-beta.6 core-rest-pipeline/1.10.2 OS/Win32" + }, + "RequestBody": { + "name": "demo_session", + "driverMemory": "28g", + "driverCores": 4, + "executorMemory": "28g", + "executorCores": 4, + "numExecutors": 2 + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Length": "94", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 17 Jan 2023 19:33:19 GMT", + "Server": [ + "Kestrel", + "Microsoft-HTTPAPI/2.0" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-activity-id": "225b91c7-452a-46d5-9116-c374484c5a85", + "x-ms-client-request-id": "bd635d4e-cf55-4a30-aa3c-283d8a1efb69", + "x-ms-job-clusterrequested-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-ended-on": "", + "x-ms-job-internal-id": "1", + "x-ms-job-livysubmission-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-queued-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-result": "Uncertain", + "x-ms-job-scheduled-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-scheduler-state": "Queued", + "x-ms-job-submitted-by-name": "99b56ce0-a666-484e-b2b0-cee1dbca1680", + "x-ms-job-submitted-on": "1/17/2023 7:33:19 PM \u002B00:00", + "x-ms-job-type": "SparkServiceSession", + "x-ms-request-id": "51617ca1-7454-439d-b86f-7fd32f976d7a" + }, + "ResponseBody": { + "id": 1, + "appId": null, + "appInfo": null, + "state": "not_started", + "log": null, + "registeredSources": null + } + } + ], + "Variables": {} +} diff --git a/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_list_sessions.json b/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_list_sessions.json index a4ad4724b5bf..3c420384bdf6 100644 --- a/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_list_sessions.json +++ b/sdk/synapse/synapse-spark/recordings/browsers/synapse_managed_private_endpoints/recording_should_list_sessions.json @@ -1,52 +1,63 @@ { - "recordings": [ - { - "method": "POST", - "url": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token", - "query": {}, - "requestBody": "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fsanitized%2F", - "status": 200, - "response": "{\"token_type\":\"Bearer\",\"expires_in\":86399,\"ext_expires_in\":86399,\"access_token\":\"access_token\"}", - "responseHeaders": { - "cache-control": "no-store, no-cache", - "content-length": "1322", - "content-type": "application/json; charset=utf-8", - "date": "Tue, 10 Aug 2021 20:26:33 GMT", - "expires": "-1", - "nel": "{\"report_to\":\"network-errors\",\"max_age\":86400,\"success_fraction\":0.001,\"failure_fraction\":1.0}", - "p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"", - "pragma": "no-cache", - "referrer-policy": "strict-origin-when-cross-origin", - "report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://identity.nel.measure.office.net/api/report?catId=GW+estsfd+san\"}]}", - "strict-transport-security": "max-age=31536000; includeSubDomains", - "x-content-type-options": "nosniff", - "x-ms-ests-server": "2.1.11935.14 - SCUS ProdSlices", - "x-ms-request-id": "fadb5160-6cac-46f7-a665-233fb6100000" - } - }, - { - "method": "GET", - "url": "https://testaccount.dev.azuresynapse.net/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions", - "query": {}, - "requestBody": null, - "status": 200, - "response": "{\"from\":0,\"total\":20,\"sessions\":[{\"id\":9,\"appId\":\"application_1628552050977_0007\",\"appInfo\":{\"driverLogUrl\":\"http://d3bdd27a029942e8b116889ad2df853c003e1c44323:8042/node/containerlogs/container_1628552050977_0007_01_000001/trusted-service-user\",\"sparkUiUrl\":\"http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0007/\",\"isSessionTimedOut\":\"true\"},\"state\":\"dead\",\"log\":[\"\\t tracking URL: http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0007/\",\"\\t user: trusted-service-user\",\"21/08/09 23:56:25 INFO ShutdownHookManager: Shutdown hook called\",\"21/08/09 23:56:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-9b0c5aab-edc7-45ee-81bf-579ddf7743c9\",\"21/08/09 23:56:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-c998cf7d-9373-4042-badc-3b46fae5fc6f\",\"21/08/09 23:56:25 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...\",\"21/08/09 23:56:25 INFO MetricsSystemImpl: azure-file-system metrics system stopped.\",\"21/08/09 23:56:25 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.\",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":10,\"appId\":\"application_1628552050977_0008\",\"appInfo\":{\"driverLogUrl\":\"http://d3bdd27a029942e8b116889ad2df853c003db842456:8042/node/containerlogs/container_1628552050977_0008_01_000001/trusted-service-user\",\"sparkUiUrl\":\"http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0008/\",\"isSessionTimedOut\":\"true\"},\"state\":\"dead\",\"log\":[\"\\t tracking URL: http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0008/\",\"\\t user: trusted-service-user\",\"21/08/09 23:59:20 INFO ShutdownHookManager: Shutdown hook called\",\"21/08/09 23:59:20 INFO ShutdownHookManager: Deleting directory /tmp/spark-b417ffae-5dc8-4e87-886d-5187e5537846\",\"21/08/09 23:59:20 INFO ShutdownHookManager: Deleting directory /tmp/spark-74ff6670-9a2a-4ea4-bfaa-2dee5129cbd5\",\"21/08/09 23:59:20 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...\",\"21/08/09 23:59:20 INFO MetricsSystemImpl: azure-file-system metrics system stopped.\",\"21/08/09 23:59:20 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.\",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":17,\"appId\":\"application_1628626490330_0001\",\"appInfo\":{\"driverLogUrl\":\"http://fcb56c1652644ce788aaf828196d9cb400135519550:8042/node/containerlogs/container_1628626490330_0001_01_000001/trusted-service-user\",\"sparkUiUrl\":\"http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0001/\",\"isSessionTimedOut\":\"true\"},\"state\":\"dead\",\"log\":[\"\\t tracking URL: http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0001/\",\"\\t user: trusted-service-user\",\"21/08/10 20:15:18 INFO ShutdownHookManager: Shutdown hook called\",\"21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-3a6db1d3-8268-4fd3-8571-abc0f9ed62ae\",\"21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-a7f16008-fa48-4694-a5f3-9e37b8413b58\",\"21/08/10 20:15:18 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...\",\"21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system stopped.\",\"21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.\",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":18,\"appId\":\"application_1628626490330_0002\",\"appInfo\":{\"driverLogUrl\":\"http://fcb56c1652644ce788aaf828196d9cb400495c68195:8042/node/containerlogs/container_1628626490330_0002_01_000001/trusted-service-user\",\"sparkUiUrl\":\"http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0002/\",\"isSessionTimedOut\":\"true\"},\"state\":\"dead\",\"log\":[\"\\t tracking URL: http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0002/\",\"\\t user: trusted-service-user\",\"21/08/10 20:15:18 INFO ShutdownHookManager: Shutdown hook called\",\"21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-81d42dd5-dfee-4207-987a-720e1d945c6d\",\"21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-982afeba-acf8-4a35-b947-009adeb638dc\",\"21/08/10 20:15:18 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...\",\"21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system stopped.\",\"21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.\",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":19,\"appId\":\"application_1628626490330_0003\",\"appInfo\":{\"driverLogUrl\":\"http://fcb56c1652644ce788aaf828196d9cb4001ebe94562:8042/node/containerlogs/container_1628626490330_0003_01_000001/trusted-service-user\",\"sparkUiUrl\":\"http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0003/\",\"isSessionTimedOut\":\"true\"},\"state\":\"dead\",\"log\":[\"\\t tracking URL: http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0003/\",\"\\t user: trusted-service-user\",\"21/08/10 20:15:25 INFO ShutdownHookManager: Shutdown hook called\",\"21/08/10 20:15:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-a0d7e240-e9e1-4643-9903-3512e2803e54\",\"21/08/10 20:15:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-24f0f6cb-56e6-4b6f-97c1-f757f3837e00\",\"21/08/10 20:15:25 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...\",\"21/08/10 20:15:25 INFO MetricsSystemImpl: azure-file-system metrics system stopped.\",\"21/08/10 20:15:25 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.\",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":20,\"appId\":null,\"appInfo\":{\"driverLogUrl\":null,\"sparkUiUrl\":null,\"isSessionTimedOut\":\"false\"},\"state\":\"starting\",\"log\":[\"stdout: \",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":21,\"appId\":null,\"appInfo\":{\"driverLogUrl\":null,\"sparkUiUrl\":null,\"isSessionTimedOut\":\"false\"},\"state\":\"starting\",\"log\":[\"stdout: \",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":22,\"appId\":null,\"appInfo\":{\"driverLogUrl\":null,\"sparkUiUrl\":null,\"isSessionTimedOut\":\"false\"},\"state\":\"starting\",\"log\":[\"stdout: \",\"\\nstderr: \",\"\\nYARN Diagnostics: \"]},{\"id\":23,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":24,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":25,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":26,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":27,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":28,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":29,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":30,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":31,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":32,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":33,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null},{\"id\":34,\"appId\":null,\"appInfo\":null,\"state\":\"not_started\",\"log\":null}]}", - "responseHeaders": { - "content-type": "application/json; charset=utf-8", - "date": "Tue, 10 Aug 2021 20:26:33 GMT", - "server": "Kestrel Microsoft-HTTPAPI/2.0", - "status": "200", - "strict-transport-security": "max-age=31536000; includeSubDomains", - "x-ms-activity-id": "bf4d4802-fe23-4206-a74f-4962b5364b23", - "x-ms-client-request-id": "6fab3034-2238-4775-9522-0beffabb7a50", - "x-ms-request-id": "878499b8-8a9e-4d43-b5fc-68152f77fb52", - "x-ms-response-time-ms": "166" - } - } - ], - "uniqueTestInfo": { - "uniqueName": {}, - "newDate": {} - }, - "hash": "fd0e964348b53bd7f2b6e0fab7983ffb" -} \ No newline at end of file + "Entries": [ + { + "RequestUri": "https://testaccount.dev.azuresynapse.net/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/109.0.5412.0 Safari/537.36", + "x-ms-client-request-id": "f6e773e2-8a70-441b-9b35-7adb44655765", + "x-ms-useragent": "azsdk-js-synapse-spark/1.0.0-beta.6 core-rest-pipeline/1.10.2 OS/Win32" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Length": "223", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 17 Jan 2023 19:33:19 GMT", + "Server": [ + "Kestrel", + "Microsoft-HTTPAPI/2.0" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-activity-id": "e4de4842-4b0d-46bb-a53c-8679ba9cff93", + "x-ms-client-request-id": "f6e773e2-8a70-441b-9b35-7adb44655765", + "x-ms-request-id": "fd2c83e8-5a34-4a74-9123-a9ab656285a8" + }, + "ResponseBody": { + "from": 0, + "total": 2, + "sessions": [ + { + "id": 1, + "appId": null, + "appInfo": null, + "state": "not_started", + "log": null, + "registeredSources": null + }, + { + "id": 0, + "appId": null, + "appInfo": null, + "state": "not_started", + "log": null, + "registeredSources": null + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_create_session.js b/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_create_session.js deleted file mode 100644 index f78a106a8010..000000000000 --- a/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_create_session.js +++ /dev/null @@ -1,156 +0,0 @@ -let nock = require('nock'); - -module.exports.hash = "aec64ee63ff1999a26f64d3e21aff0ba"; - -module.exports.testInfo = {"uniqueName":{},"newDate":{}} - -nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) - .get('/common/discovery/instance') - .query(true) - .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration","api-version":"1.1","metadata":[{"preferred_network":"login.microsoftonline.com","preferred_cache":"login.windows.net","aliases":["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{"preferred_network":"login.partner.microsoftonline.cn","preferred_cache":"login.partner.microsoftonline.cn","aliases":["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{"preferred_network":"login.microsoftonline.de","preferred_cache":"login.microsoftonline.de","aliases":["login.microsoftonline.de"]},{"preferred_network":"login.microsoftonline.us","preferred_cache":"login.microsoftonline.us","aliases":["login.microsoftonline.us","login.usgovcloudapi.net"]},{"preferred_network":"login-us.microsoftonline.com","preferred_cache":"login-us.microsoftonline.com","aliases":["login-us.microsoftonline.com"]}]}, [ - 'Cache-Control', - 'max-age=86400, private', - 'Content-Type', - 'application/json; charset=utf-8', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'X-Content-Type-Options', - 'nosniff', - 'Access-Control-Allow-Origin', - '*', - 'Access-Control-Allow-Methods', - 'GET, OPTIONS', - 'P3P', - 'CP="DSP CUR OTPi IND OTRi ONL FIN"', - 'x-ms-request-id', - '87c3dec5-837d-4565-b072-eb1b5e3be500', - 'x-ms-ests-server', - '2.1.11935.12 - NCUS ProdSlices', - 'Set-Cookie', - 'fpc=AgRoTrDZjTpElY2pAMJYCRQ; expires=Thu, 09-Sep-2021 20:26:20 GMT; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr0zOAy4Pxt53QX2imoWg2RJ7mpYUpjD7h5EMSZQ8oQ1y2q9a5ADhnJOCvrUqNdpGMNlUfIKcy3lQ1eYGcYbBSF-txxlE5V-FoMG_H7LdIrtqIp8jlLNIqWrjGe_PXSrM8UDgPTBb2Y6Vzyn0h80cqtrdZ2xgvR_avC5z_VoIyEuIgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', - 'Set-Cookie', - 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', - 'Date', - 'Tue, 10 Aug 2021 20:26:19 GMT', - 'Content-Length', - '980' -]); - -nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) - .get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration') - .reply(200, {"token_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys","response_modes_supported":["query","fragment","form_post"],"subject_types_supported":["pairwise"],"id_token_signing_alg_values_supported":["RS256"],"response_types_supported":["code","id_token","code id_token","id_token token"],"scopes_supported":["openid","profile","email","offline_access"],"issuer":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout","claims_supported":["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],"kerberos_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos","tenant_region_scope":"WW","cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}, [ - 'Cache-Control', - 'max-age=86400, private', - 'Content-Type', - 'application/json; charset=utf-8', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'X-Content-Type-Options', - 'nosniff', - 'Access-Control-Allow-Origin', - '*', - 'Access-Control-Allow-Methods', - 'GET, OPTIONS', - 'P3P', - 'CP="DSP CUR OTPi IND OTRi ONL FIN"', - 'x-ms-request-id', - 'a143c5cd-3fff-42f9-97e2-b95f4bc50000', - 'x-ms-ests-server', - '2.1.11935.14 - SCUS ProdSlices', - 'Set-Cookie', - 'fpc=AkPxHzA2z6RKmZPP5xuEaFU; expires=Thu, 09-Sep-2021 20:26:20 GMT; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrT1yY_6zd4Vg9hqaNx1TTLWwlv95BAeiTpXj9Dr6UiHH-4SxfkaC0oC7FcjR-L_hCJfxPfnw0EfksKMhaKa9ULRXEMJA10G9UVYaHwbz0NP6ta0-cdFactZHftBsICCTdh3iYICo6EL-Lly8AwKQnc_IWCJlpVHo2Dzc6QJK_dYogAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', - 'Set-Cookie', - 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', - 'Date', - 'Tue, 10 Aug 2021 20:26:19 GMT', - 'Content-Length', - '1753' -]); - -nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) - .post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.2.0&x-client-OS=linux&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=2|771,0|,&x-client-last-telemetry=2|0|||0,0&client-request-id=cf950f16-4a7c-4ffc-bb19-d9d862d23b28&client_secret=azure_client_secret") - .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [ - 'Cache-Control', - 'no-store, no-cache', - 'Pragma', - 'no-cache', - 'Content-Type', - 'application/json; charset=utf-8', - 'Expires', - '-1', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'X-Content-Type-Options', - 'nosniff', - 'P3P', - 'CP="DSP CUR OTPi IND OTRi ONL FIN"', - 'x-ms-request-id', - 'b7e82f41-829d-4f2f-bbdd-876676e0c900', - 'x-ms-ests-server', - '2.1.11935.12 - EUS ProdSlices', - 'x-ms-clitelem', - '1,0,0,,', - 'Set-Cookie', - 'fpc=Aii8BLqLLDRGjqlP01W5dF7KOuyWAQAAAOzXpNgOAAAA; expires=Thu, 09-Sep-2021 20:26:20 GMT; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', - 'Set-Cookie', - 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', - 'Date', - 'Tue, 10 Aug 2021 20:26:19 GMT', - 'Content-Length', - '1322' -]); - -nock('https://testaccount.dev.azuresynapse.net', {"encodedQueryParams":true}) - .post('/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions', {"name":"demo_session","driverMemory":"28g","driverCores":4,"executorMemory":"28g","executorCores":4,"numExecutors":2}) - .reply(200, {"id":33,"appId":null,"appInfo":null,"state":"not_started","log":null}, [ - 'Transfer-Encoding', - 'chunked', - 'Content-Type', - 'application/json; charset=utf-8', - 'Server', - 'Kestrel Microsoft-HTTPAPI/2.0', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'x-ms-job-submitted-by-name', - '30511c9d-ba1a-4c7b-b422-5b543da11b3f', - 'x-ms-job-submitted-on', - '8/10/2021 8:26:20 PM +00:00', - 'x-ms-job-scheduled-on', - '1/1/0001 12:00:00 AM +00:00', - 'x-ms-job-ended-on', - '', - 'x-ms-job-scheduler-state', - 'Queued', - 'x-ms-job-internal-id', - '33', - 'x-ms-job-result', - 'Uncertain', - 'x-ms-job-type', - 'SparkServiceSession', - 'x-ms-job-queued-on', - '1/1/0001 12:00:00 AM +00:00', - 'x-ms-job-clusterrequested-on', - '1/1/0001 12:00:00 AM +00:00', - 'x-ms-job-livysubmission-on', - '1/1/0001 12:00:00 AM +00:00', - 'x-ms-response-time-ms', - '4650', - 'x-ms-activity-id', - '4fa4a3f1-bea7-4db4-91d1-eb39da74b2fe', - 'x-ms-client-request-id', - 'fbd1fb00-20db-4fc9-be56-0f2884931003', - 'x-ms-request-id', - '88535ef7-c447-480a-b000-8cceb16c3c5d', - 'Date', - 'Tue, 10 Aug 2021 20:26:24 GMT' -]); diff --git a/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_create_session.json b/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_create_session.json new file mode 100644 index 000000000000..4df33f7e6767 --- /dev/null +++ b/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_create_session.json @@ -0,0 +1,60 @@ +{ + "Entries": [ + { + "RequestUri": "https://testaccount.dev.azuresynapse.net/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Content-Length": "118", + "Content-Type": "application/json", + "User-Agent": "azsdk-js-synapse-spark/1.0.0-beta.6 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "e14ebaf3-6871-4bf2-8292-eebc54afd600" + }, + "RequestBody": { + "name": "demo_session", + "driverMemory": "28g", + "driverCores": 4, + "executorMemory": "28g", + "executorCores": 4, + "numExecutors": 2 + }, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Length": "94", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 17 Jan 2023 19:33:06 GMT", + "Server": [ + "Kestrel", + "Microsoft-HTTPAPI/2.0" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-activity-id": "608aa3c7-e4bb-4fda-9223-c261e726cd4b", + "x-ms-client-request-id": "e14ebaf3-6871-4bf2-8292-eebc54afd600", + "x-ms-job-clusterrequested-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-ended-on": "", + "x-ms-job-internal-id": "0", + "x-ms-job-livysubmission-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-queued-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-result": "Uncertain", + "x-ms-job-scheduled-on": "1/1/0001 12:00:00 AM \u002B00:00", + "x-ms-job-scheduler-state": "Queued", + "x-ms-job-submitted-by-name": "99b56ce0-a666-484e-b2b0-cee1dbca1680", + "x-ms-job-submitted-on": "1/17/2023 7:33:06 PM \u002B00:00", + "x-ms-job-type": "SparkServiceSession", + "x-ms-request-id": "b53b0b1a-3a42-4a61-801b-f9a5dd4ee2d6" + }, + "ResponseBody": { + "id": 0, + "appId": null, + "appInfo": null, + "state": "not_started", + "log": null, + "registeredSources": null + } + } + ], + "Variables": {} +} diff --git a/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_list_sessions.js b/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_list_sessions.js deleted file mode 100644 index ae20edf354b0..000000000000 --- a/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_list_sessions.js +++ /dev/null @@ -1,134 +0,0 @@ -let nock = require('nock'); - -module.exports.hash = "769c7b76f0ccbf6d624ecf24fb0d4543"; - -module.exports.testInfo = {"uniqueName":{},"newDate":{}} - -nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) - .get('/common/discovery/instance') - .query(true) - .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration","api-version":"1.1","metadata":[{"preferred_network":"login.microsoftonline.com","preferred_cache":"login.windows.net","aliases":["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{"preferred_network":"login.partner.microsoftonline.cn","preferred_cache":"login.partner.microsoftonline.cn","aliases":["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{"preferred_network":"login.microsoftonline.de","preferred_cache":"login.microsoftonline.de","aliases":["login.microsoftonline.de"]},{"preferred_network":"login.microsoftonline.us","preferred_cache":"login.microsoftonline.us","aliases":["login.microsoftonline.us","login.usgovcloudapi.net"]},{"preferred_network":"login-us.microsoftonline.com","preferred_cache":"login-us.microsoftonline.com","aliases":["login-us.microsoftonline.com"]}]}, [ - 'Cache-Control', - 'max-age=86400, private', - 'Content-Type', - 'application/json; charset=utf-8', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'X-Content-Type-Options', - 'nosniff', - 'Access-Control-Allow-Origin', - '*', - 'Access-Control-Allow-Methods', - 'GET, OPTIONS', - 'P3P', - 'CP="DSP CUR OTPi IND OTRi ONL FIN"', - 'x-ms-request-id', - '2ed2b765-f859-4906-9e34-7b9e7daf5504', - 'x-ms-ests-server', - '2.1.11898.12 - EUS ProdSlices', - 'Set-Cookie', - 'fpc=AmSjUYE8oeFDiTp0r7nVslo; expires=Thu, 09-Sep-2021 20:26:25 GMT; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr75uLxh2GyrG7WRjEKg8tSqt5auKQIdKfLBUb2uMG3vvQ8U7LUw-Hg7pUzRyVOZp5lYYrFFh5CNQRmR7mjF8B4iTOyV_SMuCBYdG0zr4-PjhUCqUtPKF9zyWs6Sr5yqbDsNkVhMu8ptyFKnUSRrlbC36p7X0ChUN2PR7FCUQUYxQgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', - 'Set-Cookie', - 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', - 'Date', - 'Tue, 10 Aug 2021 20:26:24 GMT', - 'Content-Length', - '980' -]); - -nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) - .get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration') - .reply(200, {"token_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys","response_modes_supported":["query","fragment","form_post"],"subject_types_supported":["pairwise"],"id_token_signing_alg_values_supported":["RS256"],"response_types_supported":["code","id_token","code id_token","id_token token"],"scopes_supported":["openid","profile","email","offline_access"],"issuer":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout","claims_supported":["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],"kerberos_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos","tenant_region_scope":"WW","cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}, [ - 'Cache-Control', - 'max-age=86400, private', - 'Content-Type', - 'application/json; charset=utf-8', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'X-Content-Type-Options', - 'nosniff', - 'Access-Control-Allow-Origin', - '*', - 'Access-Control-Allow-Methods', - 'GET, OPTIONS', - 'P3P', - 'CP="DSP CUR OTPi IND OTRi ONL FIN"', - 'x-ms-request-id', - 'ffdf1d3f-162f-4ad5-bdf2-0d33685dae00', - 'x-ms-ests-server', - '2.1.11935.12 - NCUS ProdSlices', - 'Set-Cookie', - 'fpc=ApzbnmeBehNOvXDzjPUBTPE; expires=Thu, 09-Sep-2021 20:26:25 GMT; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrfkuit9ka8GjaLrYB-T3MJX_aRFpeolat5NikseAgmCMkkjDMkSrUcm2CgVC9a-2k23vKOqaB4uIlmAnddgMg9H2KCZENNjBS3f8P_kqc8VDSvomHtE5h-ujqi8Lg7Et8zs4NKmR8Cmqq8QT4lPHh9wBGe0-e50PMMvxLTJu4gfwgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', - 'Set-Cookie', - 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', - 'Date', - 'Tue, 10 Aug 2021 20:26:24 GMT', - 'Content-Length', - '1753' -]); - -nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) - .post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.2.0&x-client-OS=linux&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=2|771,0|,&x-client-last-telemetry=2|0|||0,0&client-request-id=ea64357e-7d34-4e04-ad6a-26779330315e&client_secret=azure_client_secret") - .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [ - 'Cache-Control', - 'no-store, no-cache', - 'Pragma', - 'no-cache', - 'Content-Type', - 'application/json; charset=utf-8', - 'Expires', - '-1', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'X-Content-Type-Options', - 'nosniff', - 'P3P', - 'CP="DSP CUR OTPi IND OTRi ONL FIN"', - 'x-ms-request-id', - 'b368498d-7b50-43c7-ba0d-a60e0a50ce00', - 'x-ms-ests-server', - '2.1.11935.12 - EUS ProdSlices', - 'x-ms-clitelem', - '1,0,0,,', - 'Set-Cookie', - 'fpc=AqKMeKMYSidAqZUmj5Abz4bKOuyWAQAAAPDXpNgOAAAA; expires=Thu, 09-Sep-2021 20:26:25 GMT; path=/; secure; HttpOnly; SameSite=None', - 'Set-Cookie', - 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', - 'Set-Cookie', - 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', - 'Date', - 'Tue, 10 Aug 2021 20:26:25 GMT', - 'Content-Length', - '1322' -]); - -nock('https://testaccount.dev.azuresynapse.net', {"encodedQueryParams":true}) - .get('/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions') - .reply(200, {"from":0,"total":20,"sessions":[{"id":9,"appId":"application_1628552050977_0007","appInfo":{"driverLogUrl":"http://d3bdd27a029942e8b116889ad2df853c003e1c44323:8042/node/containerlogs/container_1628552050977_0007_01_000001/trusted-service-user","sparkUiUrl":"http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0007/","isSessionTimedOut":"true"},"state":"dead","log":["\t tracking URL: http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0007/","\t user: trusted-service-user","21/08/09 23:56:25 INFO ShutdownHookManager: Shutdown hook called","21/08/09 23:56:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-9b0c5aab-edc7-45ee-81bf-579ddf7743c9","21/08/09 23:56:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-c998cf7d-9373-4042-badc-3b46fae5fc6f","21/08/09 23:56:25 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...","21/08/09 23:56:25 INFO MetricsSystemImpl: azure-file-system metrics system stopped.","21/08/09 23:56:25 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.","\nstderr: ","\nYARN Diagnostics: "]},{"id":10,"appId":"application_1628552050977_0008","appInfo":{"driverLogUrl":"http://d3bdd27a029942e8b116889ad2df853c003db842456:8042/node/containerlogs/container_1628552050977_0008_01_000001/trusted-service-user","sparkUiUrl":"http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0008/","isSessionTimedOut":"true"},"state":"dead","log":["\t tracking URL: http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0008/","\t user: trusted-service-user","21/08/09 23:59:20 INFO ShutdownHookManager: Shutdown hook called","21/08/09 23:59:20 INFO ShutdownHookManager: Deleting directory /tmp/spark-b417ffae-5dc8-4e87-886d-5187e5537846","21/08/09 23:59:20 INFO ShutdownHookManager: Deleting directory /tmp/spark-74ff6670-9a2a-4ea4-bfaa-2dee5129cbd5","21/08/09 23:59:20 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...","21/08/09 23:59:20 INFO MetricsSystemImpl: azure-file-system metrics system stopped.","21/08/09 23:59:20 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.","\nstderr: ","\nYARN Diagnostics: "]},{"id":17,"appId":"application_1628626490330_0001","appInfo":{"driverLogUrl":"http://fcb56c1652644ce788aaf828196d9cb400135519550:8042/node/containerlogs/container_1628626490330_0001_01_000001/trusted-service-user","sparkUiUrl":"http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0001/","isSessionTimedOut":"true"},"state":"dead","log":["\t tracking URL: http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0001/","\t user: trusted-service-user","21/08/10 20:15:18 INFO ShutdownHookManager: Shutdown hook called","21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-3a6db1d3-8268-4fd3-8571-abc0f9ed62ae","21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-a7f16008-fa48-4694-a5f3-9e37b8413b58","21/08/10 20:15:18 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...","21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system stopped.","21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.","\nstderr: ","\nYARN Diagnostics: "]},{"id":18,"appId":"application_1628626490330_0002","appInfo":{"driverLogUrl":"http://fcb56c1652644ce788aaf828196d9cb400495c68195:8042/node/containerlogs/container_1628626490330_0002_01_000001/trusted-service-user","sparkUiUrl":"http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0002/","isSessionTimedOut":"true"},"state":"dead","log":["\t tracking URL: http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0002/","\t user: trusted-service-user","21/08/10 20:15:18 INFO ShutdownHookManager: Shutdown hook called","21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-81d42dd5-dfee-4207-987a-720e1d945c6d","21/08/10 20:15:18 INFO ShutdownHookManager: Deleting directory /tmp/spark-982afeba-acf8-4a35-b947-009adeb638dc","21/08/10 20:15:18 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...","21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system stopped.","21/08/10 20:15:18 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.","\nstderr: ","\nYARN Diagnostics: "]},{"id":19,"appId":"application_1628626490330_0003","appInfo":{"driverLogUrl":"http://fcb56c1652644ce788aaf828196d9cb4001ebe94562:8042/node/containerlogs/container_1628626490330_0003_01_000001/trusted-service-user","sparkUiUrl":"http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0003/","isSessionTimedOut":"true"},"state":"dead","log":["\t tracking URL: http://fcb56c1652644ce788aaf828196d9cb400197b73200:8088/proxy/application_1628626490330_0003/","\t user: trusted-service-user","21/08/10 20:15:25 INFO ShutdownHookManager: Shutdown hook called","21/08/10 20:15:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-a0d7e240-e9e1-4643-9903-3512e2803e54","21/08/10 20:15:25 INFO ShutdownHookManager: Deleting directory /tmp/spark-24f0f6cb-56e6-4b6f-97c1-f757f3837e00","21/08/10 20:15:25 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...","21/08/10 20:15:25 INFO MetricsSystemImpl: azure-file-system metrics system stopped.","21/08/10 20:15:25 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.","\nstderr: ","\nYARN Diagnostics: "]},{"id":20,"appId":null,"appInfo":{"driverLogUrl":null,"sparkUiUrl":null,"isSessionTimedOut":"false"},"state":"starting","log":["stdout: ","\nstderr: ","\nYARN Diagnostics: "]},{"id":21,"appId":null,"appInfo":{"driverLogUrl":null,"sparkUiUrl":null,"isSessionTimedOut":"false"},"state":"starting","log":["stdout: ","\nstderr: ","\nYARN Diagnostics: "]},{"id":22,"appId":null,"appInfo":{"driverLogUrl":null,"sparkUiUrl":null,"isSessionTimedOut":"false"},"state":"starting","log":["stdout: ","\nstderr: ","\nYARN Diagnostics: "]},{"id":23,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":24,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":25,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":26,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":27,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":28,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":29,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":30,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":31,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":32,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":33,"appId":null,"appInfo":null,"state":"not_started","log":null},{"id":3,"appId":"application_1628552050977_0001","appInfo":{"driverLogUrl":"http://d3bdd27a029942e8b116889ad2df853c00376412812:8042/node/containerlogs/container_1628552050977_0001_01_000001/trusted-service-user","sparkUiUrl":"http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0001/","isSessionTimedOut":"true"},"state":"dead","log":["\t tracking URL: http://d3bdd27a029942e8b116889ad2df853c00376412812:8088/proxy/application_1628552050977_0001/","\t user: trusted-service-user","21/08/09 23:34:35 INFO ShutdownHookManager: Shutdown hook called","21/08/09 23:34:35 INFO ShutdownHookManager: Deleting directory /tmp/spark-613915bd-e857-4dce-896c-6853c88aa376","21/08/09 23:34:35 INFO ShutdownHookManager: Deleting directory /tmp/spark-550ee1ed-4f5b-4c6c-9765-b6ac0fe95193","21/08/09 23:34:35 INFO MetricsSystemImpl: Stopping azure-file-system metrics system...","21/08/09 23:34:35 INFO MetricsSystemImpl: azure-file-system metrics system stopped.","21/08/09 23:34:35 INFO MetricsSystemImpl: azure-file-system metrics system shutdown complete.","\nstderr: ","\nYARN Diagnostics: "]}]}, [ - 'Transfer-Encoding', - 'chunked', - 'Content-Type', - 'application/json; charset=utf-8', - 'Server', - 'Kestrel Microsoft-HTTPAPI/2.0', - 'Strict-Transport-Security', - 'max-age=31536000; includeSubDomains', - 'x-ms-response-time-ms', - '160', - 'x-ms-activity-id', - 'f9755f9d-bfb1-4e90-ab22-dcac80f617a8', - 'x-ms-client-request-id', - '9b5a1a66-7632-49d2-8688-c5ed2db976bc', - 'x-ms-request-id', - 'd0c39e0c-9251-4436-8da2-b20d5961453a', - 'Date', - 'Tue, 10 Aug 2021 20:26:25 GMT' -]); diff --git a/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_list_sessions.json b/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_list_sessions.json new file mode 100644 index 000000000000..9c8f41119e4a --- /dev/null +++ b/sdk/synapse/synapse-spark/recordings/node/synapse_managed_private_endpoints/recording_should_list_sessions.json @@ -0,0 +1,46 @@ +{ + "Entries": [ + { + "RequestUri": "https://testaccount.dev.azuresynapse.net/livyApi/versions/2019-11-01-preview/sparkPools/testsparkpool/sessions", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-synapse-spark/1.0.0-beta.6 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "cc804ab4-4a93-4521-b008-90ee8663dfd3" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Content-Length": "128", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 17 Jan 2023 19:33:07 GMT", + "Server": [ + "Kestrel", + "Microsoft-HTTPAPI/2.0" + ], + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "x-ms-activity-id": "2ff369e9-48b8-48bf-80cd-0b9369d38b72", + "x-ms-client-request-id": "cc804ab4-4a93-4521-b008-90ee8663dfd3", + "x-ms-request-id": "3a191c95-610c-4dde-9086-bf526f6f5879" + }, + "ResponseBody": { + "from": 0, + "total": 1, + "sessions": [ + { + "id": 0, + "appId": null, + "appInfo": null, + "state": "not_started", + "log": null, + "registeredSources": null + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/synapse/synapse-spark/test/public/test.spec.ts b/sdk/synapse/synapse-spark/test/public/test.spec.ts index d26ce80bae65..a39de310b196 100644 --- a/sdk/synapse/synapse-spark/test/public/test.spec.ts +++ b/sdk/synapse/synapse-spark/test/public/test.spec.ts @@ -7,10 +7,10 @@ describe("Synapse Managed Private Endpoints", () => { let recorder: Recorder; let client: SparkClient; - beforeEach(function() { - recorder = createRecorder(this); + beforeEach(async function() { + recorder = await createRecorder(this); const spark_pool_name = "testsparkpool"; - client = createClient(spark_pool_name); + client = createClient(spark_pool_name, recorder.configureClientOptions({})); }); afterEach(async () => { diff --git a/sdk/synapse/synapse-spark/test/public/utils/recordedClient.ts b/sdk/synapse/synapse-spark/test/public/utils/recordedClient.ts index b589cd857baa..e89b05b3a4dc 100644 --- a/sdk/synapse/synapse-spark/test/public/utils/recordedClient.ts +++ b/sdk/synapse/synapse-spark/test/public/utils/recordedClient.ts @@ -3,58 +3,19 @@ import "./env"; -import { ClientSecretCredential, TokenCredential } from "@azure/identity"; import { - Recorder, - RecorderEnvironmentSetup, - env, - isLiveMode, - record, + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; import { SparkClient, SparkClientOptionalParams } from "../../../src"; -import { createXhrHttpClient, isNode } from "@azure/test-utils"; - import { Context } from "mocha"; - -const replaceableVariables: { [k: string]: string } = { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - ENDPOINT: "https://testaccount.dev.azuresynapse.net", -}; - -export const environmentSetup: RecorderEnvironmentSetup = { - replaceableVariables, - customizationsOnRecordings: [ - (recording: string): string => - recording.replace(/"access_token"\s?:\s?"[^"]*"/g, `"access_token":"access_token"`), - // If we put ENDPOINT in replaceableVariables above, it will not capture - // the endpoint string used with nock, which will be expanded to - // https://:443/ and therefore will not match, so we have to do - // this instead. - (recording: string): string => { - const replaced = recording.replace( - "testaccount.dev.azuresynapse.net:443", - "testaccount.dev.azuresynapse.net" - ); - return replaced; - }, - ], - queryParametersToSkip: [], -}; +import { createTestCredential } from "@azure-tools/test-credential"; export function createClient(pool: string, options?: SparkClientOptionalParams): SparkClient { - let credential: TokenCredential; - const httpClient = isNode || isLiveMode() ? undefined : createXhrHttpClient(); - - credential = new ClientSecretCredential( - env.AZURE_TENANT_ID, - env.AZURE_CLIENT_ID, - env.AZURE_CLIENT_SECRET, - { httpClient } - ); - return new SparkClient(credential, env.ENDPOINT, pool, { ...options, httpClient }); + const credential = createTestCredential(); + return new SparkClient(credential, env.ENDPOINT as string, pool, { ...options }); } /** @@ -62,6 +23,16 @@ export function createClient(pool: string, options?: SparkClientOptionalParams): * Should be called first in the test suite to make sure environment variables are * read before they are being used. */ -export function createRecorder(context: Context): Recorder { - return record(context, environmentSetup); +export async function createRecorder(context: Context): Promise { + const recorderStartOptions: RecorderStartOptions = { + envSetupForPlayback: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + ENDPOINT: "https://testaccount.dev.azuresynapse.net" + }, + }; + const recorder = new Recorder(context.currentTest); + await recorder.start(recorderStartOptions); + return recorder; }