How to use the etcd3.Etcd3.prototype function in etcd3

To help you get started, we’ve selected a few etcd3 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 cloudfoundry-incubator / service-fabrik-broker / test / test_broker / bosh.BoshOperationQueue.spec.js View on Github external
it('should throw cache update error if store op fails', () => {
      putStub = sandbox.stub(Etcd3.prototype, 'put', (k) => new PutStubber(hash, k, true));
      containsStub = sandbox.stub(subject, 'containsDeployment', () => Promise.resolve(false));
      return subject.saveDeployment('plan_id', '5', {}, {}).catch(err => {
        expect(err.code).to.eql('ETCDERROR');
      });
    });
  });
github cloudfoundry-incubator / service-fabrik-broker / test / test_broker / bosh.BoshOperationCache.spec.js View on Github external
it('should return true if task is in cache', () => {
      getStub = sandbox.stub(Etcd3.prototype, 'get', (k) => new SingleRangeStubber(hash, k));
      return subject.containsBoshTask('1').then(o => {
        expect(o).to.eql(true);
      });
    });
    it('should return false if task is not in cache', () => {
github cloudfoundry-incubator / service-fabrik-broker / test / test_broker / bosh.BoshOperationCache.spec.js View on Github external
it('should store deployment in cache if absent previously', () => {
      putStub = sandbox.stub(Etcd3.prototype, 'put', (k) => new PutStubber(hash, k));
      containsStub = sandbox.stub(subject, 'containsDeployment', () => Promise.resolve(false));
      return subject.store('plan_id', '4', {
        param: 'value'
      }, {
        arg: 'val'
      }).then(o => {
        expect(o).to.eql(true);
      });
    });
    it('should not store again if previously present in cache', () => {
github cloudfoundry-incubator / service-fabrik-broker / test / test_broker / bosh.BoshOperationQueue.spec.js View on Github external
it('should return true if task is in cache', () => {
      getStub = sandbox.stub(Etcd3.prototype, 'get', (k) => new SingleRangeStubber(hash, k));
      return subject.containsBoshTask('1').then(o => {
        expect(o).to.eql(true);
      });
    });
    it('should return false if task is not in cache', () => {
github cloudfoundry-incubator / service-fabrik-broker / test / test_broker / eventmesh.LockManager.spec.js View on Github external
beforeEach(() => {
      sandbox = sinon.sandbox.create();
      valueStub = sandbox.stub();
      acquireStub = sandbox.stub();
      releaseStub = sandbox.stub();
      jsonStub = sandbox.stub();
      putStub = sandbox.stub(Etcd3.prototype, 'put', () => {
        return {
          value: (val) => Promise.resolve(valueStub(val))
        };
      });
      getStub = sandbox.stub(Etcd3.prototype, 'get', () => {
        return {
          json: () => Promise.resolve(jsonStub())
        };
      });
      lockStub = sandbox.stub(Etcd3.prototype, 'lock', () => {
        return {
          ttl: () => {
            return {
              acquire: () => Promise.resolve(acquireStub())
            };
          },
github cloudfoundry-incubator / service-fabrik-broker / test / test_broker / eventmesh.Etcd3EventMeshServer.spec.js View on Github external
before(() => {
      sandbox = sinon.sandbox.create();
      valueStub = sandbox.stub();
      stringStub = sandbox.stub();
      jsonStub = sandbox.stub();
      putstub = sandbox.stub(Etcd3.prototype, 'put', () => {
        return {
          value: (val) => Promise.resolve(valueStub(val))
        };
      });
      getstub = sandbox.stub(Etcd3.prototype, 'get', () => {
        return {
          json: () => Promise.resolve(jsonStub()),
          string: () => Promise.resolve(stringStub()),
        };
      });

      prefixWatcherStub = sandbox.stub().returns({
        create: () => Promise.resolve({
          on: () => Promise.resolve('prefixWatcherStubResponse')
        }),
      });
github cloudfoundry-incubator / service-fabrik-broker / test / test_broker / eventmesh.Etcd3EventMeshServer.spec.js View on Github external
before(() => {
      sandbox = sinon.sandbox.create();
      valueStub = sandbox.stub();
      stringStub = sandbox.stub();
      jsonStub = sandbox.stub();
      putstub = sandbox.stub(Etcd3.prototype, 'put', () => {
        return {
          value: (val) => Promise.resolve(valueStub(val))
        };
      });
      getstub = sandbox.stub(Etcd3.prototype, 'get', () => {
        return {
          json: () => Promise.resolve(jsonStub()),
          string: () => Promise.resolve(stringStub()),
        };
      });

      prefixWatcherStub = sandbox.stub().returns({
        create: () => Promise.resolve({
          on: () => Promise.resolve('prefixWatcherStubResponse')
        }),
      });
      keyWatcherStub = sandbox.stub().returns({
        create: () => Promise.resolve({
          on: () => Promise.resolve('keyWatcherStubResponse')
        }),
      });
github cloudfoundry-incubator / service-fabrik-broker / test / test_broker / eventmesh.LockManager.spec.js View on Github external
beforeEach(() => {
      sandbox = sinon.sandbox.create();
      valueStub = sandbox.stub();
      acquireStub = sandbox.stub();
      releaseStub = sandbox.stub();
      jsonStub = sandbox.stub();
      putStub = sandbox.stub(Etcd3.prototype, 'put', () => {
        return {
          value: (val) => Promise.resolve(valueStub(val))
        };
      });
      getStub = sandbox.stub(Etcd3.prototype, 'get', () => {
        return {
          json: () => Promise.resolve(jsonStub())
        };
      });
      lockStub = sandbox.stub(Etcd3.prototype, 'lock', () => {
        return {
          ttl: () => {
            return {
              acquire: () => Promise.resolve(acquireStub())
            };
          },
          release: () => Promise.resolve(releaseStub())
        };
      });
    });

etcd3

Node client for etcd3

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis

Popular etcd3 functions