Skip to content

Commit 55a93fb

Browse files
authored
[Synapse Access Control] Migrating to the new Recorder (Azure#20153)
* Migrate to new recorder * Update recordings * CI Config
1 parent e5971de commit 55a93fb

23 files changed

+620
-1202
lines changed

sdk/synapse/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pr:
2424
extends:
2525
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
2626
parameters:
27+
TestProxy: true
2728
ServiceDirectory: synapse
2829
Artifacts:
2930
- name: azure-synapse-access-control

sdk/synapse/synapse-access-control-rest/karma.conf.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
// https://github.com/karma-runner/karma-chrome-launcher
55
process.env.CHROME_BIN = require("puppeteer").executablePath();
66
require("dotenv").config();
7-
const {
8-
jsonRecordingFilterFunction,
9-
isPlaybackMode,
10-
isSoftRecordMode,
11-
isRecordMode
12-
} = require("@azure-tools/test-recorder");
7+
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
8+
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
139

1410
module.exports = function(config) {
1511
config.set({
@@ -31,25 +27,21 @@ module.exports = function(config) {
3127
"karma-coverage",
3228
"karma-sourcemap-loader",
3329
"karma-junit-reporter",
34-
"karma-json-to-file-reporter",
3530
"karma-source-map-support",
36-
"karma-json-preprocessor"
3731
],
3832

3933
// list of files / patterns to load in the browser
4034
files: [
4135
"dist-test/index.browser.js",
4236
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }
43-
].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []),
44-
37+
],
4538
// list of files / patterns to exclude
4639
exclude: [],
4740

4841
// preprocess matching files before serving them to the browser
4942
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
5043
preprocessors: {
5144
"**/*.js": ["sourcemap", "env"],
52-
"recordings/browsers/**/*.json": ["json"]
5345
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
5446
// Preprocess source file to calculate code coverage, however this will make source file unreadable
5547
// "dist-test/index.js": ["coverage"]
@@ -60,13 +52,14 @@ module.exports = function(config) {
6052
"ENDPOINT",
6153
"AZURE_CLIENT_ID",
6254
"AZURE_CLIENT_SECRET",
63-
"AZURE_TENANT_ID"
55+
"AZURE_TENANT_ID",
56+
"RECORDINGS_RELATIVE_PATH"
6457
],
6558

6659
// test results reporter to use
6760
// possible values: 'dots', 'progress'
6861
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
69-
reporters: ["mocha", "coverage", "junit", "json-to-file"],
62+
reporters: ["mocha", "coverage", "junit"],
7063

7164
coverageReporter: {
7265
// specify a common output directory
@@ -89,11 +82,6 @@ module.exports = function(config) {
8982
properties: {} // key value pair of properties to add to the <properties> section of the report
9083
},
9184

92-
jsonToFileReporter: {
93-
filter: jsonRecordingFilterFunction,
94-
outputPath: "."
95-
},
96-
9785
// web server port
9886
port: 9876,
9987

@@ -128,9 +116,6 @@ module.exports = function(config) {
128116
browserNoActivityTimeout: 60000000,
129117
browserDisconnectTimeout: 10000,
130118
browserDisconnectTolerance: 3,
131-
browserConsoleLogOptions: {
132-
terminal: !isRecordMode()
133-
},
134119

135120
client: {
136121
mocha: {

sdk/synapse/synapse-access-control-rest/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@azure/dev-tool": "^1.0.0",
4646
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
4747
"@azure/identity": "^2.0.1",
48-
"@azure-tools/test-recorder": "^1.0.0",
48+
"@azure-tools/test-recorder": "^2.0.0",
4949
"@azure/core-util": "1.0.0-beta.1",
5050
"@microsoft/api-extractor": "^7.18.11",
5151
"@types/chai": "^4.1.6",
@@ -81,7 +81,8 @@
8181
"sinon": "^9.0.2",
8282
"source-map-support": "^0.5.9",
8383
"ts-node": "^10.0.0",
84-
"typescript": "~4.2.0"
84+
"typescript": "~4.2.0",
85+
"@azure-tools/test-credential": "^1.0.0"
8586
},
8687
"bugs": {
8788
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
@@ -110,8 +111,8 @@
110111
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
111112
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
112113
"test": "npm run clean && npm run build:test && npm run unit-test",
113-
"unit-test:browser": "karma start --single-run",
114-
"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\"",
114+
"unit-test:browser": "dev-tool run test:browser",
115+
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
115116
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
116117
"extract-api": "api-extractor run --local",
117118
"clean": "rimraf dist dist-* temp types *.tgz *.log",

sdk/synapse/synapse-access-control-rest/recordings/browsers/access_control_smoke/recording_should_list_rbac_scopes.json

Lines changed: 41 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/synapse/synapse-access-control-rest/recordings/browsers/access_control_smoke/recording_should_list_roles.json

Lines changed: 41 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/synapse/synapse-access-control-rest/recordings/browsers/access_control_smoke_role_assignments/recording_should_create_a_role_assignment.json

Lines changed: 46 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/synapse/synapse-access-control-rest/recordings/browsers/access_control_smoke_role_assignments/recording_should_delete_role_assignment.json

Lines changed: 34 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)