How to use the ms-rest.ExponentialRetryPolicyFilter function in ms-rest

To help you get started, we’ve selected a few ms-rest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-java / AutoRest / Generators / NodeJS / Azure.NodeJS.Tests / AcceptanceTests / head.js View on Github external
describe('Head Exception Operations', function () {
      var testOptions = clientOptions;
      testOptions.requestOptions = { jar: true };
      testOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
      testOptions.noRetryPolicy = true;
      var testClient = new headExceptionClient(credentials, baseUri, clientOptions);

      it('should return true for 200 status code', function (done) {
        testClient.headException.head200(function (error, result) {
          should.not.exist(error);
          done();
        });
      });

      it('should return true for 204 status code', function (done) {
        testClient.headException.head204(function (error, result) {
          should.not.exist(error);
          done();
        });
      });
github Azure / azure-sdk-for-java / AutoRest / Generators / NodeJS / Azure.NodeJS.Tests / AcceptanceTests / lro.js View on Github external
describe('Swagger LRO Happy BAT', function () {
    clientOptions.requestOptions = { jar: true };
    clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
    clientOptions.noRetryPolicy = true;
    clientOptions.longRunningOperationRetryTimeout = 0;

    var testClient = new lroClient(credentials, baseUri, clientOptions);
    var product = { location: 'West US' };
    it('should work with Put201CreatingSucceeded200', function (done) {
      testClient.lROs.put201CreatingSucceeded200(product, function (error, result) {
        should.not.exist(error);
        done();
      });
    });

    it('should work with Put201CreatingFailed200', function (done) {
      testClient.lROs.put201CreatingFailed200(product, function (error, result) {
        should.exist(error);
        error.message.should.be.exactly('Long running operation failed with status: \'Failed\'.');
github Azure / azure-sdk-for-java / AutoRest / Generators / NodeJS / Azure.NodeJS.Tests / AcceptanceTests / lro.js View on Github external
describe('Swagger LRO Sad BAT', function () {
    clientOptions.requestOptions = { jar: true };
    clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
    clientOptions.noRetryPolicy = true;

    var testClient = new lroClient(credentials, baseUri, clientOptions);
    testClient.longRunningOperationRetryTimeout = 0;
    var product = { location: 'West US' };

    //TODO: Port more C# test case over after 4103936 Fix exception type

    it('should throw on PutNonRetry400', function (done) {
      testClient.lROSADs.putNonRetry400(product, function (error, result) {
        should.exist(error);
        error.message.should.containEql('{"message":"Expected bad request message","status":400}');
        done();
      });
    });
github Azure / azure-sdk-for-java / AutoRest / Generators / NodeJS / Azure.NodeJS.Tests / AcceptanceTests / paging.js View on Github external
describe('Pageable Operations', function () {
      clientOptions.requestOptions = { jar: true };
      clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
      clientOptions.noRetryPolicy = true;
      var testClient = new pagingClient(credentials, baseUri, clientOptions);

      it('should get single pages', function (done) {
        testClient.paging.getSinglePages(function (error, result) {
          should.not.exist(error);
          should.not.exist(result.nextLink);
          done();
        });
      });

      it('should get multiple pages', function (done) {
          testClient.paging.getMultiplePages({'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (error, result) {
          var loop = function (nextLink, count) {
            if (nextLink !== null && nextLink !== undefined) {
                testClient.paging.getMultiplePagesNext(nextLink, {'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (err, res) {
github Azure / autorest / src / generator / AutoRest.NodeJS.Azure.Tests / AcceptanceTests / head.js View on Github external
describe('Head Operations', function () {
      var testOptions = clientOptions;
      testOptions.requestOptions = { jar: true };
      testOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
      testOptions.noRetryPolicy = true;
      var testClient = new headClient(credentials, baseUri, clientOptions);

      it('should return true for 200 status code', function (done) {
        testClient.httpSuccess.head200(function (error, result) {
          should.not.exist(error);
          result.should.be.exactly(true);
          done();
        });
      });

      it('should return true for 204 status code', function (done) {
        testClient.httpSuccess.head204(function (error, result) {
          should.not.exist(error);
          result.should.be.exactly(true);
          done();
github Azure / autorest / src / generator / AutoRest.NodeJS.Azure.Tests / AcceptanceTests / paging.js View on Github external
describe('Pageable Operations', function () {
      clientOptions.requestOptions = { jar: true };
      clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
      clientOptions.noRetryPolicy = true;
      var testClient = new pagingClient(credentials, baseUri, clientOptions);

      it('should get single pages', function (done) {
        testClient.paging.getSinglePages(function (error, result) {
          should.not.exist(error);
          should.not.exist(result.nextLink);
          done();
        });
      });

      it('should get multiple pages', function (done) {
          testClient.paging.getMultiplePages({'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (error, result) {
          var loop = function (nextLink, count) {
            if (nextLink !== null && nextLink !== undefined) {
                testClient.paging.getMultiplePagesNext(nextLink, {'clientRequestId': 'client-id', 'pagingGetMultiplePagesOptions': null}, function (err, res) {
github Azure / azure-sdk-for-java / AutoRest / Generators / NodeJS / Azure.NodeJS.Tests / AcceptanceTests / resourceFlattening.js View on Github external
describe('Resource Flattening Operations', function () {
      var testOptions = clientOptions;
      testOptions.requestOptions = { jar: true };
      testOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
      testOptions.noRetryPolicy = true;
      var testClient = new flatteningClient(credentials, baseUri, clientOptions);

      it('should get external resource as an array', function (done) {
        var expectedResult = [
          {
            id: '1',
            location: 'Building 44',
            name: 'Resource1',
            properties: {
              provisioningState: 'Succeeded',
              provisioningStateValues: 'OK',
              pname: 'Product1',
              type: 'Flat'
            },
            tags: { tag1: 'value1', tag2: 'value3' },
github Azure / autorest / src / generator / AutoRest.NodeJS.Azure.Tests / AcceptanceTests / lro.js View on Github external
describe('Swagger LRO Happy BAT', function () {
    clientOptions.requestOptions = { jar: true };
    clientOptions.filters = [new msRest.ExponentialRetryPolicyFilter(3, 0, 0, 0)];
    clientOptions.noRetryPolicy = true;
    clientOptions.longRunningOperationRetryTimeout = 0;

    var testClient = new lroClient(credentials, baseUri, clientOptions);
    var product = { location: 'West US' };
    it('should work with Put201CreatingSucceeded200', function (done) {
      testClient.lROs.put201CreatingSucceeded200(product, function (error, result) {
        should.not.exist(error);
        done();
      });
    });

    it('should work with Put201CreatingFailed200', function (done) {
      testClient.lROs.put201CreatingFailed200(product, function (error, result) {
        should.exist(error);
        error.message.should.be.exactly('Long running operation failed with status: "Failed".');