How to use internal - 10 common examples

To help you get started, we’ve selected a few internal 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 arangodb / arangodb / tests / js / server / resilience / transactions / resilience-transactions.js View on Github external
const waitForTasks = () => {
  const time = require("internal").time;
  const start = time();
  while (!tasksCompleted()) {
    if (time() - start > 300) { // wait for 5 minutes maximum
      fail("Timeout after 5 minutes");
    }
    require("internal").wait(0.5, false);
  }
  require('internal').wal.flush(true, true);
  // wait an extra second for good measure
  require("internal").wait(1.0, false);
};
github arangodb / arangodb / tests / js / server / resilience / transactions / resilience-transactions.js View on Github external
const waitForTasks = () => {
  const time = require("internal").time;
  const start = time();
  while (!tasksCompleted()) {
    if (time() - start > 300) { // wait for 5 minutes maximum
      fail("Timeout after 5 minutes");
    }
    require("internal").wait(0.5, false);
  }
  require('internal').wal.flush(true, true);
  // wait an extra second for good measure
  require("internal").wait(1.0, false);
};
github arangodb / arangodb / tests / js / server / recovery / multiple-journals-mmfiles.js View on Github external
db._drop('UnitTestsRecovery');
  var c = db._create('UnitTestsRecovery'), i, fig;

  for (i = 0; i < 1000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.wal.flush(true, true);
 
  // wait until journal appears 
  while (true) {
    fig = c.figures();
    if (fig.journals.count > 0) {
      break;
    }
    internal.wait(1, false);
  }
  c.rotate();

  for (i = 1000; i < 2000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.wal.flush(true, true);
 
  // wait until next journal appears 
  while (true) {
    fig = c.figures();
    if (fig.journals.count > 0) {
      break;
    }
    internal.wait(1, false);
github arangodb / arangodb / tests / js / server / recovery / multiple-journals-3-mmfiles.js View on Github external
db._drop('UnitTestsRecovery');
  var c = db._create('UnitTestsRecovery'), i, fig;

  for (i = 0; i < 1000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.wal.flush(true, true);
 
  // wait until journal appears 
  while (true) {
    fig = c.figures();
    if (fig.journals.count > 0) {
      break;
    }
    internal.wait(1, false);
  }

  internal.debugSetFailAt('CreateMultipleJournals');

  c.rotate();

  for (i = 200; i < 400; ++i) {
    c.remove('test' + i);
  }
  for (i = 500; i < 700; ++i) {
    c.update('test' + i, { value2: 'test' + i });
  }

  internal.wal.flush(true, true);
  
  // wait until next journal appears 
github arangodb / arangodb / tests / js / server / recovery / create-with-temp-mmfiles.js View on Github external
function runSetup () {
  'use strict';

  var path = fs.join(db._path(), 'collection-999999999999-123456');
  fs.makeDirectory(path);
  fs.write(fs.join(path, '.tmp'), ''); // create .tmp file

  path = fs.join(db._path(), 'collection-999999999998-123456.tmp');
  fs.makeDirectory(path);

  internal.debugTerminate('crashing server');
}
github arangodb / arangodb / tests / js / server / recovery / collector-oom.js View on Github external
function runSetup () {
  'use strict';
  internal.debugClearFailAt();

  db._drop('UnitTestsRecovery');
  var c = db._create('UnitTestsRecovery'), i;
  for (i = 0; i < 10000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.debugSetFailAt('CollectorThreadProcessQueuedOperations');
  internal.wal.flush(true, false);
  internal.wait(5);

  internal.debugTerminate('crashing server');
}
github arangodb / arangodb / tests / js / common / shell / shell-deadlocks-timecritical-noncluster-mmfiles-grey.js View on Github external
action: function () {
            require("internal").wait(7, false);
            var db = require("internal").db;
            db.UnitTestsDeadlock2.any();
            db.UnitTestsDeadlock1.insert({ done: true });
          }
        });
github arangodb / arangodb / tests / js / server / recovery / collector-oom.js View on Github external
function runSetup () {
  'use strict';
  internal.debugClearFailAt();

  db._drop('UnitTestsRecovery');
  var c = db._create('UnitTestsRecovery'), i;
  for (i = 0; i < 10000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.debugSetFailAt('CollectorThreadProcessQueuedOperations');
  internal.wal.flush(true, false);
  internal.wait(5);

  internal.debugTerminate('crashing server');
}
github arangodb / arangodb / tests / js / client / shell / shell-foxx-cors-spec.js View on Github external
it("sends a CORS options request", function () {
      var opts = { headers: { origin }, method: "OPTIONS" };
      var result = internal.download(origin + "/unittest/headers/header-echo", "", opts);
      expect(result.code).to.equal(200);
      expect(result.headers['access-control-expose-headers']).to.equal('etag, content-encoding, content-length, location, server, x-arango-errors, x-arango-async-id');
      expect(result.headers).not.to.have.property('access-control-allow-headers');
      expect(result.headers['access-control-allow-credentials']).to.equal('true');
      expect(result.headers['access-control-allow-origin']).to.equal(origin);
      expect(result.headers['access-control-allow-methods']).to.equal('DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT');
    });
github arangodb / arangodb / tests / js / client / authentication / foxx-arango-auth-spec.js View on Github external
it('defaults to authenticated user when present', function () {
    const opts = { headers: {
      authorization: (
        'Basic ' + new Buffer('root:').toString('base64')
      )
    }};
    const result = internal.download(url + mount, '', opts);
    expect(result.code).to.equal(200);
    expect(result.body).to.eql(JSON.stringify({user: 'root'}));
  });

internal

MIT
Latest version published 5 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages