Skip to content

Commit bae1b0e

Browse files
authored
update @azure/core-rest-pipeline to 1.12.2 (#25)
1 parent 5f35f2d commit bae1b0e

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

package-lock.json

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

test/clientOptions.test.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class HttpRequestCountPolicy {
2828

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

36-
after(() => {
36+
afterEach(() => {
3737
nock.restore();
3838
})
3939

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

99-
// Note:
100-
// core-rest-pipeline skips the retry throwing `RestError: getaddrinfo ENOTFOUND azure.azconfig.io`
101-
// Probably would be fixed in upstream libs.
102-
// See https://github.com/Azure/azure-sdk-for-js/issues/27037
103-
it("should retry on DNS failure");
99+
it("should retry on DNS failure", async () => {
100+
nock.restore(); // stop mocking with 500 error but sending real requests which will fail with ENOTFOUND
101+
const countPolicy = new HttpRequestCountPolicy();
102+
const loadPromise = () => {
103+
return load(createMockedConnectionString(fakeEndpoint), {
104+
clientOptions: {
105+
additionalPolicies: [{
106+
policy: countPolicy,
107+
position: "perRetry"
108+
}]
109+
}
110+
})
111+
};
112+
let error;
113+
try {
114+
await loadPromise();
115+
} catch (e) {
116+
error = e;
117+
}
118+
expect(error).not.undefined;
119+
expect(countPolicy.count).eq(3);
120+
});
104121
})

0 commit comments

Comments
 (0)