Skip to content

update @azure/core-rest-pipeline to 1.12.2 #25

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

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 24 additions & 7 deletions test/clientOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class HttpRequestCountPolicy {

describe("custom client options", function () {
const fakeEndpoint = "https://azure.azconfig.io";
before(() => {
beforeEach(() => {
// Thus here mock it to reply 500, in which case the retry mechanism works.
nock(fakeEndpoint).persist().get(() => true).reply(500);
});

after(() => {
afterEach(() => {
nock.restore();
})

Expand Down Expand Up @@ -96,9 +96,26 @@ describe("custom client options", function () {
expect(countPolicy.count).eq(2);
});

// Note:
// core-rest-pipeline skips the retry throwing `RestError: getaddrinfo ENOTFOUND azure.azconfig.io`
// Probably would be fixed in upstream libs.
// See https://github.com/Azure/azure-sdk-for-js/issues/27037
it("should retry on DNS failure");
it("should retry on DNS failure", async () => {
nock.restore(); // stop mocking with 500 error but sending real requests which will fail with ENOTFOUND
const countPolicy = new HttpRequestCountPolicy();
const loadPromise = () => {
return load(createMockedConnectionString(fakeEndpoint), {
clientOptions: {
additionalPolicies: [{
policy: countPolicy,
position: "perRetry"
}]
}
})
};
let error;
try {
await loadPromise();
} catch (e) {
error = e;
}
expect(error).not.undefined;
expect(countPolicy.count).eq(3);
});
})