Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to match test recordings, amount of escaping differs #10659

Closed
2 of 6 tasks
nguerrera opened this issue Aug 17, 2020 · 2 comments
Closed
2 of 6 tasks

Failure to match test recordings, amount of escaping differs #10659

nguerrera opened this issue Aug 17, 2020 · 2 comments
Assignees
Labels
test-utils-recorder Label for the issues related to the common recorder

Comments

@nguerrera
Copy link
Contributor

nguerrera commented Aug 17, 2020

  • Package Name: @azure/schema-registry
  • Package Version: 1.0.0-preview.1 (not released yet)

NOTE: This is not an issue with schema-registry, but an issue with the test recorder encountered during the development of schema-registry

  • Operating system: Windows 10 2004 RTM + security updates
  • nodejs
    • version: v.14.7.0
  • browser
    • name/version:
  • typescript
    • version: 3.9.*
  • Is the bug related to documentation in

Describe the bug
Some of my tests are failing to match recording when run in node, but not in browser. It seems that the recording or what is matched against the recording does not have consistent use of quotes and escaping.

@HarshaNalluru may have more details based on his investigation so far. I am adding recorder.skip("node", link to this issue) until we figure out the issue.

To Reproduce
Checkout https://github.com/nguerrera/azure-sdk-for-js/tree/schema-registry-test and run the tests for schema-registry in node:

  1. mkdir repro
  2. git clone https://github.com/nguerrera/azure-sdk-for-js
  3. cd azure-sdk-for-js
  4. git checkout schema-registry-test
  5. rush update
  6. rush build
  7. cd sdk/schemaregistry/schema-registry
  8. npm run test:node

Expected behavior

Tests pass

Actual behavior

Tests fail to match recording.

  SchemaRegistryClient
    #constructor
      √ sets endpoint and adjusts user agent prefix
    #registerSchema
      √ rejects invalid args (55ms)
      1) registers schema
    #getSchemaId
      √ rejects invalid args
      √ rejects non-existing schema
      2) finds existing schema
    #getSchemaById
      √ rejects invalid args
      √ rejects non-existing schema
      3) finds existing schema


  6 passing (166ms)
  3 failing

  1) SchemaRegistryClient
       #registerSchema
         registers schema :
     FetchError: request to https://endpoint/$schemagroups/azsdk_js_test_group/schemas/azsdk_js_test_000011?api-version=2017-04 failed, reason: Nock: No match for request {
  "method": "PUT",
  "url": "https://endpoint/$schemagroups/azsdk_js_test_group/schemas/azsdk_js_test_000011?api-version=2017-04",
  "headers": {
    "content-type": [
      "application/json"
    ],
    "x-schema-type": [
      "avro"
    ],
    "user-agent": [
      "azsdk-js-schema-registry/1.0.0-preview.1 core-http/1.1.7 Node/v14.7.0 OS/(x64-Windows_NT-10.0.19041)"
    ],
    "x-ms-client-request-id": [
      "7432b4d9-a9d4-4474-ac69-69c9df5af399"
    ],
    "authorization": [
      "Bearer access_token"
    ],
    "cookie": [
      ""
    ],
    "accept": [
      "*/*"
    ],
    "content-length": [
      "192"
    ],
    "accept-encoding": [
      "gzip,deflate"
    ]
  },
  "body": "\"{\\\"type\\\":\\\"record\\\",\\\"name\\\":\\\"User\\\",\\\"namespace\\\":\\\"com.azure.schemaregistry.samples\\\",\\\"fields\\\":[{\\\"name\\\":\\\"name\\\",\\\"type\\\":\\\"string\\\"},{\\\"name\\\":\\\"favoriteNumber\\\",\\\"type\\\":\\\"int\\\"}]}\""
}
      at OverriddenClientRequest.<anonymous> (C:\Temp\repro\azure-sdk-for-js\common\temp\node_modules\.pnpm\node-fetch@2.6.0\node_modules\node-fetch\lib\index.js:1455:11)
      at OverriddenClientRequest.emit (events.js:314:20)
      at C:\Temp\repro\azure-sdk-for-js\common\temp\node_modules\.pnpm\nock@12.0.3\node_modules\nock\lib\intercepted_request_router.js:108:11
      at processTicksAndRejections (internal/process/task_queues.js:75:11)

  2) SchemaRegistryClient
       #getSchemaId
         finds existing schema:
     FetchError: request to https://endpoint/$schemagroups/azsdk_js_test_group/schemas/azsdk_js_test_000011?api-version=2017-04 failed, reason: Nock: No match for request {
  "method": "PUT",
  "url": "https://endpoint/$schemagroups/azsdk_js_test_group/schemas/azsdk_js_test_000011?api-version=2017-04",
  "headers": {
    "content-type": [
      "application/json"
    ],
    "x-schema-type": [
      "avro"
    ],
    "user-agent": [
      "azsdk-js-schema-registry/1.0.0-preview.1 core-http/1.1.7 Node/v14.7.0 OS/(x64-Windows_NT-10.0.19041)"
    ],
    "x-ms-client-request-id": [
      "9f690675-2320-4311-b785-2dc1710434b6"
    ],
    "authorization": [
      "Bearer access_token"
    ],
    "cookie": [
      ""
    ],
    "accept": [
      "*/*"
    ],
    "content-length": [
      "192"
    ],
    "accept-encoding": [
      "gzip,deflate"
    ]
  },
  "body": "\"{\\\"type\\\":\\\"record\\\",\\\"name\\\":\\\"User\\\",\\\"namespace\\\":\\\"com.azure.schemaregistry.samples\\\",\\\"fields\\\":[{\\\"name\\\":\\\"name\\\",\\\"type\\\":\\\"string\\\"},{\\\"name\\\":\\\"favoriteNumber\\\",\\\"type\\\":\\\"int\\\"}]}\""
}
      at OverriddenClientRequest.<anonymous> (C:\Temp\repro\azure-sdk-for-js\common\temp\node_modules\.pnpm\node-fetch@2.6.0\node_modules\node-fetch\lib\index.js:1455:11)
      at OverriddenClientRequest.emit (events.js:314:20)
      at C:\Temp\repro\azure-sdk-for-js\common\temp\node_modules\.pnpm\nock@12.0.3\node_modules\nock\lib\intercepted_request_router.js:108:11
      at processTicksAndRejections (internal/process/task_queues.js:75:11)

  3) SchemaRegistryClient
       #getSchemaById
         finds existing schema:
     FetchError: request to https://endpoint/$schemagroups/azsdk_js_test_group/schemas/azsdk_js_test_000011?api-version=2017-04 failed, reason: Nock: No match for request {
  "method": "PUT",
  "url": "https://endpoint/$schemagroups/azsdk_js_test_group/schemas/azsdk_js_test_000011?api-version=2017-04",
  "headers": {
    "content-type": [
      "application/json"
    ],
    "x-schema-type": [
      "avro"
    ],
    "user-agent": [
      "azsdk-js-schema-registry/1.0.0-preview.1 core-http/1.1.7 Node/v14.7.0 OS/(x64-Windows_NT-10.0.19041)"
    ],
    "x-ms-client-request-id": [
      "baad65c4-16f0-4e1e-b5fe-212f223b748f"
    ],
    "authorization": [
      "Bearer access_token"
    ],
    "cookie": [
      ""
    ],
    "accept": [
      "*/*"
    ],
    "content-length": [
      "192"
    ],
    "accept-encoding": [
      "gzip,deflate"
    ]
  },
  "body": "\"{\\\"type\\\":\\\"record\\\",\\\"name\\\":\\\"User\\\",\\\"namespace\\\":\\\"com.azure.schemaregistry.samples\\\",\\\"fields\\\":[{\\\"name\\\":\\\"name\\\",\\\"type\\\":\\\"string\\\"},{\\\"name\\\":\\\"favoriteNumber\\\",\\\"type\\\":\\\"int\\\"}]}\""
}
      at OverriddenClientRequest.<anonymous> (C:\Temp\repro\azure-sdk-for-js\common\temp\node_modules\.pnpm\node-fetch@2.6.0\node_modules\node-fetch\lib\index.js:1455:11)
      at OverriddenClientRequest.emit (events.js:314:20)
      at C:\Temp\repro\azure-sdk-for-js\common\temp\node_modules\.pnpm\nock@12.0.3\node_modules\nock\lib\intercepted_request_router.js:108:11
      at processTicksAndRejections (internal/process/task_queues.js:75:11)

Screenshots

Additional context

@nguerrera nguerrera added the test-utils-recorder Label for the issues related to the common recorder label Aug 17, 2020
@HarshaNalluru HarshaNalluru self-assigned this Aug 17, 2020
@ramya-rao-a ramya-rao-a added this to the Backlog milestone Aug 17, 2020
@nguerrera
Copy link
Contributor Author

With the latest schema registry sending/receiving schema as text/plain instead of JSON this no longer impacts schema registry tests. I believe there's a genuine bug here, but it was triggered by a strange case where schema registry used to encode the body as one JSON string (quoted and escaped.) I'm closing this since I don't think this will be common and we probably should only prioritize fixing this if it affects something else.

@HarshaNalluru
Copy link
Member

That's great to hear, @nguerrera. 🎈
Please un-skip the tests that were affected. Please reach out if you encounter something else.
I was planning to get to this by the end of the week, looks like I don't need to. 😀

It is still good that we have a reference in case some other service encounters this, which would then be investigated as needed.

@xirzec xirzec removed this from the Backlog milestone May 17, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
test-utils-recorder Label for the issues related to the common recorder
Projects
None yet
Development

No branches or pull requests

4 participants