コード例 #1
0
ファイル: single_server.js プロジェクト: christkv/mongral
module.exports = function(configurations) {
  //
  //  Single server runner
  //
  //

  // Configure a Run of tests
  var tests = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    
    // Execute serially
    .exeuteSerially(true)
    
    // No hints
    .schedulerHints(null)

    // The list of files to execute
    .add("tests",
      [
      	  "/test/tests/simple_model_tests.js"
        , "/test/tests/validation_tests.js"
        , "/test/tests/schema_extension_tests.js"
        , "/test/tests/transformation_tests.js"
      ]
    );

  // Export runners
  return {
      runner: tests
  }    
}
コード例 #2
0
module.exports = function(configurations) {
  //
  //  SSL tests
  //
  //

  // Configure a Run of tests
  var ssl_server_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    .exeuteSerially(true)
    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("ssl_tests",
      [
          '/test/tests/ssl/mongoclient_tests.js'
          , '/test/tests/ssl/ssl_validation_tests.js'
      ]
    );

   // Export runners
  return {
    runner: ssl_server_runner
  }    
}
コード例 #3
0
ファイル: runner.js プロジェクト: naelrouz/spa-webinar
  var executeTestSuite = function(_config) {
    // If we have a test we are filtering by
    if(argv.f) {
      runner.plugin(new FileFilter(argv.f));
    }

    if(argv.n) {
      runner.plugin(new TestNameFilter(argv.n));
    }

    // Add travis filter
    runner.plugin(new TravisFilter());

    // Skip startup
    if(startupOptions.skipStartup) {
      return runner.run(Configuration(_config));
    }

    // Skip the version download and use local mongod in PATH
    if(argv.l) {
      return runner.run(Configuration(_config));
    }

    // Kill any running MongoDB processes and
    // `install $MONGODB_VERSION` || `use existing installation` || `install stable`
    m(function(err){
      if(err) return console.error(err) && process.exit(1);

      m.current(function(err, version){
        if(err) return console.error(err) && process.exit(1);
        console.log('Running tests against MongoDB version `%s`', version);
        // Run the configuration
        runner.run(Configuration(_config));
      });
    });
  }
コード例 #4
0
module.exports = function(configurations) {
  //
  //  Single server auth
  //
  //

  // Set the test to run dependent on the platform
  var tests = [
        '/test/tests/kerberos/kdc_tests.js'
    ];

  // If we have win32 change the test
  if(process.platform == 'win32') {
    tests = [
        '/test/tests/kerberos/kdc_win32_tests.js'
    ];
  }

  // Add the remaining test
  tests.push('/test/tests/kerberos/ldap_tests.js');

  // Configure a Run of tests
  var kdc_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    .exeuteSerially(true)
    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("single_server_auth", tests);
    
  // Export runners
  return {
    runner: kdc_runner
  }    
}
コード例 #5
0
module.exports = function(configurations) {
  //
  //  Single server runner
  //
  //

  // Configure a Run of tests
  var functional_tests_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    
    // Execute serially
    .exeuteSerially(true)
    
    // No hints
    .schedulerHints(null)

    // Add default filters
    .addFilter(defaultFilters)

    // The list of files to execute
    .add("functional_tests",
      [
        '/test/tests/functional/mongo_reply_parser_tests.js'
        , '/test/tests/functional/connection_pool_tests.js'
        , '/test/tests/functional/gridstore/readstream_tests.js'
        , '/test/tests/functional/gridstore/grid_tests.js'
        , '/test/tests/functional/gridstore/gridstore_direct_streaming_tests.js'
        , '/test/tests/functional/gridstore/gridstore_tests.js'
        , '/test/tests/functional/gridstore/gridstore_stream_tests.js'
        , '/test/tests/functional/gridstore/gridstore_file_tests.js'
        , '/test/tests/functional/util_tests.js'
        , '/test/tests/functional/multiple_db_tests.js'
        , '/test/tests/functional/logging_tests.js'
        , '/test/tests/functional/custom_pk_tests.js'
        , '/test/tests/functional/geo_tests.js'
        , '/test/tests/functional/write_preferences_tests.js'
        , '/test/tests/functional/remove_tests.js'
        , '/test/tests/functional/unicode_tests.js'
        , '/test/tests/functional/raw_tests.js'
        , '/test/tests/functional/mapreduce_tests.js'
        , '/test/tests/functional/cursorstream_tests.js'
        , '/test/tests/functional/index_tests.js'
        , '/test/tests/functional/cursor_tests.js'
        , '/test/tests/functional/find_tests.js'
        , '/test/tests/functional/insert_tests.js'
        , '/test/tests/functional/admin_mode_tests.js'
        , '/test/tests/functional/aggregation_tests.js'
        , '/test/tests/functional/exception_tests.js'
        , '/test/tests/functional/error_tests.js'
        , '/test/tests/functional/command_generation_tests.js'
        , '/test/tests/functional/uri_tests.js'
        , '/test/tests/functional/url_parser_tests.js'
        , '/test/tests/functional/objectid_tests.js'
        , '/test/tests/functional/connection_tests.js'
        , '/test/tests/functional/collection_tests.js'
        , '/test/tests/functional/db_tests.js'
        , '/test/tests/functional/domain_tests.js'
        , '/test/tests/functional/read_preferences_tests.js'
        // , '/test/tests/functional/fluent_api/aggregation_tests.js'
        , '/test/tests/functional/maxtimems_tests.js'
        , '/test/tests/functional/mongo_client_tests.js'
        , '/test/tests/functional/fluent_api/batch_write_ordered_tests.js'
        , '/test/tests/functional/fluent_api/batch_write_unordered_tests.js'
        , '/test/tests/functional/fluent_api/batch_write_concerns_tests.js'
      ]
    );

  //
  //  Single server auth
  //
  //

  // Configure a Run of tests
  var auth_single_server_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    .exeuteSerially(true)

    // Add default filters
    .addFilter(defaultFilters)

    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("single_server_auth",
      [
          '/test/tests/authentication/authentication_tests.js'
      ]
    );

  // Export runners
  return {
      runner: functional_tests_runner
    , runner_auth: auth_single_server_runner
  }    
}
コード例 #6
0
module.exports = function(configurations) {
  //
  //  Replicaset runner
  //
  //
  var buckets = {};
  var test_results = [];
  var schedulingData = null;

  try {
    schedulingData = fs.readFileSync('./stats.tmp', 'utf8');
    schedulingData = JSON.parse(schedulingData);
  } catch(err) {}

  // Configure a Run of tests
  var repl_set_parallel_tests_runner = ParallelRunner
    // Add configurations to the test runner
    .configurations(configurations)
    // The number of parallel contexts we are running with
    .parallelContexts(4)
    // Parallelize at test or file level
    .parallelizeAtLevel(ParallelRunner.TEST)
    // Execute all tests serially in each context
    .exeuteSerially(true)
    // Load runtime information data (used by scheduler)
    // to balance execution as much as possible
    // needs to be array of Json objects with fields {file, test, time}
    .schedulerHints(schedulingData)
    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("replica_set",
      [
          '/test/tests/repl_set/reconnect_tests.js'
        , '/test/tests/repl_set/connecting_tests.js'
        , '/test/tests/repl_set/secondary_queries_tests.js'
        , '/test/tests/repl_set/mongoclient_tests.js'
        , '/test/tests/repl_set/read_preferences_tests.js'
        , '/test/tests/repl_set/read_preferences_spec_tests.js'
        , '/test/tests/repl_set/failover_query_tests.js'
      ]
    );

  // After each test is done
  repl_set_parallel_tests_runner.on('test_done', function(test_statistics) {
    console.log("==================================== TEST_DONE")
    console.log("==================================== TEST_DONE")
    console.log("==================================== TEST_DONE")
    // Unpack statistics
    var time_spent = test_statistics.end_time.getTime() - test_statistics.start_time.getTime();
    var test = test_statistics.name;
    var file = test_statistics.file_name;
    var config = test_statistics.config_name;

    // Add to bucket
    if(!Array.isArray(buckets[test_statistics.configuration.startPort])) {
      buckets[test_statistics.configuration.startPort] = [];
    }

    // Stat object
    var stat = {
        port: test_statistics.configuration.startPort
      , time: time_spent
      , test: test
      , file: file
      , config: config
    };

    // Save statistics about test to it's bucket
    buckets[test_statistics.configuration.startPort].push(stat);
    // Save to list
    test_results.push(stat);
  });

  // After test suite is finished
  repl_set_parallel_tests_runner.on('end', function() {
    console.log("==================================== TEST_END")
    console.log("==================================== TEST_END")
    console.log("==================================== TEST_END")
    for(var name in buckets) {
      var tests = buckets[name];
      var total_time = 0;

      for(var i = 0; i < tests.length; i++) {
        total_time = total_time + tests[i].time;
      }
    }

    // Sort in descending order
    test_results = test_results.sort(function(a, b) { return b.time - a.time });
    var json = JSON.stringify(test_results);
    fs.writeFileSync('./stats.tmp', json, 'utf8');
  });

  //
  //  Replicaset server auth
  //
  //

  // Configure a Run of tests
  var auth_replset_server_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    .exeuteSerially(true)
    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("replset_server_auth",
      [
          '/test/tests/authentication/authentication_replicaset_tests.js'
      ]
    );

  // Export runners
  return {
      runner: repl_set_parallel_tests_runner
    , runner_auth: auth_replset_server_runner
  }
}
コード例 #7
0
module.exports = function(configurations) {
  //
  //  Replicaset runner
  //
  //
  var buckets = {};
  var test_results = [];
  var schedulingData = null;

  // Get environmental variables that are known
  var node_version_array = process
      .version
      .replace(/v/g, '')
      .split('.')
      .map(function(x) { return parseInt(x, 10) });
  var mongodb_version_array = null;

  // Check if we have a valid node.js method
  var validVersions = function(compare_version, version) {
    var comparator = version.slice(0, 1)
    var version_array = version
        .slice(1).split(/\./).map(function(x) { return parseInt(x, 10); });

    // Comparator
    if(comparator == '>') {
      if(compare_version[0] >= version_array[0]
        && compare_version[1] >= version_array[1]
        && compare_version[2] >= version_array[2])
        return true;
    }
    
    // No valid node version
    return false;
  }

  try {
    schedulingData = fs.readFileSync('./stats.tmp', 'utf8');
    schedulingData = JSON.parse(schedulingData);
  } catch(err) {}

  // Configure a Run of tests
  var repl_set_parallel_tests_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)

    // The number of parallel contexts we are running with
    .parallelContexts(4)

    // Execute all tests serially in each context
    .exeuteSerially(true)

    // Load runtime information data (used by scheduler)
    // to balance execution as much as possible
    // needs to be array of Json objects with fields {file, test, time}
    .schedulerHints(schedulingData)

    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("replica_set",
      [
          '/test/tests/repl_set/reconnect_tests.js'
        , '/test/tests/repl_set/connecting_tests.js'
        , '/test/tests/repl_set/secondary_queries_tests.js'
        , '/test/tests/repl_set/mongoclient_tests.js'
        , '/test/tests/repl_set/read_preferences_tests.js'
        , '/test/tests/repl_set/read_preferences_spec_tests.js'
        , '/test/tests/repl_set/failover_query_tests.js'
        , '/test/tests/repl_set/replicaset_examples_tests.js'
        , '/test/tests/repl_set/recovering_server_tests.js'
      ]
    );

  // After each test is done
  repl_set_parallel_tests_runner.on('test_done', function(test_statistics) {
    // Unpack statistics
    var time_spent = test_statistics.end_time.getTime() - test_statistics.start_time.getTime();
    var test = test_statistics.name;
    var file = test_statistics.file_name;
    var config = test_statistics.config_name;

    // Add to bucket
    if(!Array.isArray(buckets[test_statistics.configuration.startPort])) {
      buckets[test_statistics.configuration.startPort] = [];
    }

    // Stat object
    var stat = {
        port: test_statistics.configuration.startPort
      , time: time_spent
      , test: test
      , file: file
      , config: config
    };

    // Save statistics about test to it's bucket
    buckets[test_statistics.configuration.startPort].push(stat);
    // Save to list
    test_results.push(stat);
  });

  // After test suite is finished
  repl_set_parallel_tests_runner.on('end', function() {
    for(var name in buckets) {
      var tests = buckets[name];
      var total_time = 0;

      for(var i = 0; i < tests.length; i++) {
        total_time = total_time + tests[i].time;
      }
    }

    // Sort in descending order
    test_results = test_results.sort(function(a, b) { return b.time - a.time });
    var json = JSON.stringify(test_results);
    fs.writeFileSync('./stats.tmp', json, 'utf8');
  });

  //
  //  Replicaset server auth
  //
  //

  // Configure a Run of tests
  var auth_replset_server_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    .exeuteSerially(true)
    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("replset_server_auth",
      [
          '/test/tests/authentication/authentication_replicaset_tests.js'
      ]
    );

  // Export runners
  return {
      runner: repl_set_parallel_tests_runner
    , runner_auth: auth_replset_server_runner
  }
}
コード例 #8
0
ファイル: runner.js プロジェクト: naelrouz/spa-webinar
 m.current(function(err, version){
   if(err) return console.error(err) && process.exit(1);
   console.log('Running tests against MongoDB version `%s`', version);
   // Run the configuration
   runner.run(Configuration(_config));
 });
コード例 #9
0
ファイル: runner.js プロジェクト: naelrouz/spa-webinar
testFiles.forEach(function(t) {
  if(t != "") runner.add(t);
});
コード例 #10
0
ファイル: runner.js プロジェクト: naelrouz/spa-webinar
      port: port,
      host: host,
      setName: setName,
      db: db,
      manager: manager,
      replicasetName: replicasetName,
      writeConcern: function() { return clone(writeConcern) },
      writeConcernMax: function() { return clone(writeConcernMax) }
    }
  }
}

// Set up the runner
var runner = new Runner({
    // logLevel:'error'
    logLevel:'info'
  , runners: 1
  , failFast: true
});

var testFiles = [
  // Logging tests
    '/test/functional/logger_tests.js'

  // APM tests
  , '/test/functional/apm_tests.js'

  // Connection spec tests
  , '/test/functional/connection_string_spec_tests.js'

  // Replicaset read concern (make sure no illegal state due to teardown tests)
  , '/test/functional/readconcern_tests.js'
コード例 #11
0
ファイル: runner.js プロジェクト: vaseker/node-mongodb-native
      database: database || options.database,
      nativeParser: true,
      port: port,
      host: host,
      writeConcern: function() { return clone(writeConcern) },
      writeConcernMax: function() { return clone(writeConcernMax) }
    }
  }

  return Configuration;
}

// Set up the runner
var runner = new Runner({
    // logLevel:'debug'
    runners: 1
  , failFast: true
});

var testFiles =[
  // Functional Tests
    '/test/functional/url_parser_tests.js'
  , '/test/functional/uri_tests.js'
  , '/test/functional/mongo_client_tests.js'
  , '/test/functional/collection_tests.js'
  , '/test/functional/db_tests.js'
  , '/test/functional/cursor_tests.js'
  , '/test/functional/insert_tests.js'
  , '/test/functional/aggregation_tests.js'
  , '/test/functional/admin_tests.js'
  , '/test/functional/connection_tests.js'
コード例 #12
0
module.exports = function(configurations) {
  //
  //  Single server runner
  //
  //

  // Get environmental variables that are known
  var node_version_array = process
      .version
      .replace(/v/g, '')
      .split('.')
      .map(function(x) { return parseInt(x, 10) });
  var mongodb_version_array = null;

  // Check if we have a valid node.js method
  var validVersions = function(compare_version, version) {
    var comparator = version.slice(0, 1)
    var version_array = version
        .slice(1).split(/\./).map(function(x) { return parseInt(x, 10); });

    // Comparator
    if(comparator == '>') {
      if(compare_version[0] >= version_array[0]
        && compare_version[1] >= version_array[1]
        && compare_version[2] >= version_array[2])
        return true;
    }
    
    // No valid node version
    return false;
  }

  // Configure a Run of tests
  var functional_tests_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    
    // Execute serially
    .exeuteSerially(true)
    
    // No hints
    .schedulerHints(null)
    
    // Query configuration for any variables we need to know
    .afterConfigurationStart(function(configuration, callback) {
      configuration.newDbInstance({w:1}).open(function(err, db) {
        db.command({buildInfo:true}, function(err, result) {
          if(err) throw err;
          mongodb_version = result.versionArray;
          db.close();
          callback();
        });
      });
    })

    // We wish to filter out tests based on tags
    .filter(function(test) {
      if(typeof test != 'function') {      
        // If we have a node.js version check
        if(test.requires && test.requires.node) 
          return validVersions(node_version_array, test.requires.node);

        if(test.requires && test.requires.mongodb) {
          return validVersions(mongodb_version, test.requires.mongodb);
        }

        if(test.requires 
          && test.requires.serverType 
          && test.requires.serverType.toLowerCase() != 'server') {
          return false;
        }
      }

      return true
    })

    // The list of files to execute
    .add("functional_tests",
      // [
      //   , '/test/tests/functional/db_tests.js'
      // ]
      [
        '/test/tests/functional/mongo_reply_parser_tests.js'
        , '/test/tests/functional/connection_pool_tests.js'
        , '/test/tests/functional/gridstore/readstream_tests.js'
        , '/test/tests/functional/gridstore/grid_tests.js'
        , '/test/tests/functional/gridstore/gridstore_direct_streaming_tests.js'
        , '/test/tests/functional/gridstore/gridstore_tests.js'
        , '/test/tests/functional/gridstore/gridstore_stream_tests.js'
        , '/test/tests/functional/gridstore/gridstore_file_tests.js'
        , '/test/tests/functional/util_tests.js'
        , '/test/tests/functional/multiple_db_tests.js'
        , '/test/tests/functional/logging_tests.js'
        , '/test/tests/functional/custom_pk_tests.js'
        , '/test/tests/functional/geo_tests.js'
        , '/test/tests/functional/write_preferences_tests.js'
        , '/test/tests/functional/remove_tests.js'
        , '/test/tests/functional/unicode_tests.js'
        , '/test/tests/functional/raw_tests.js'
        , '/test/tests/functional/mapreduce_tests.js'
        , '/test/tests/functional/cursorstream_tests.js'
        , '/test/tests/functional/index_tests.js'
        , '/test/tests/functional/cursor_tests.js'
        , '/test/tests/functional/find_tests.js'
        , '/test/tests/functional/insert_tests.js'
        , '/test/tests/functional/admin_mode_tests.js'
        , '/test/tests/functional/aggregation_tests.js'
        , '/test/tests/functional/exception_tests.js'
        , '/test/tests/functional/error_tests.js'
        , '/test/tests/functional/command_generation_tests.js'
        , '/test/tests/functional/uri_tests.js'
        , '/test/tests/functional/url_parser_tests.js'
        , '/test/tests/functional/objectid_tests.js'
        , '/test/tests/functional/connection_tests.js'
        , '/test/tests/functional/collection_tests.js'
        , '/test/tests/functional/db_tests.js'
        , '/test/tests/functional/read_preferences_tests.js'
        , '/test/tests/functional/fluent_api/aggregation_tests.js'
        , '/test/tests/functional/maxtimems_tests.js'
        , '/test/tests/functional/mongo_client_tests.js'
        , '/test/tests/functional/fluent_api/batch_write_ordered_tests.js'
        , '/test/tests/functional/fluent_api/batch_write_unordered_tests.js'
      ]
    );

  //
  //  Single server auth
  //
  //

  // Configure a Run of tests
  var auth_single_server_runner = Runner
    // Add configurations to the test runner
    .configurations(configurations)
    .exeuteSerially(true)
    // First parameter is test suite name
    // Second parameter is the configuration used
    // Third parameter is the list of files to execute
    .add("single_server_auth",
      [
          '/test/tests/authentication/authentication_tests.js'
      ]
    );

  // Export runners
  return {
      runner: functional_tests_runner
    , runner_auth: auth_single_server_runner
  }    
}