Example #1
0
  .action(function(conf) {
    var config = Config();

    var account = config.azure.account;
    var tableName = config.app.workerTypeTableName;
    var secretTable = config.app.secretTableName;
    var workerStateTable = config.app.workerStateTableName;

    var auth = new tc.Auth();

    var p = Promise.all([
      auth.azureTableSAS(account, tableName),
      auth.azureTableSAS(account, secretTable),
      auth.azureTableSAS(account, workerStateTable),
    ]);

    p = p.then(function() {
      console.log(JSON.stringify({
        outcome: 'success',
        tableName: tableName,
        secretTable: secretTable,
        workerStateTable: workerStateTable,
      }, null, 2));
    });

    p = p.catch(errorHandler);

  });
Example #2
0
  constructor(Worker, workerType, workerId) {
    super();

    // This is to avoid the node warning message:
    //    MaxListenersExceededWarning: Possible EventEmitter memory leak
    //    detected. 11 task resolved listeners added. Use
    //    emitter.setMaxListeners() to increase limit
    // During capacity tests
    this.setMaxListeners(30);

    var config = typedEnvConfig({
      files: [`${__dirname}/../config.yml`],
      profile: 'test',
      env: process.env
    });

    this.provisionerId = PROVISIONER_ID;
    // Use worker_test_ prefix so ci worker scopes can be more restrictive for
    // claiming/creating work
    this.workerType = workerType || `dummy-type-${slugid.v4()}`.substring(0, 22);
    // remove leading underscores because workerId could be used as container name
    // and container names must start with an alphanumeric character.
    this.workerId = workerId || `dummy-worker-${slugid.v4()}`.substring(0, 22);
    this.worker = new Worker(PROVISIONER_ID, this.workerType, this.workerId);

    this.pulse = config.pulse;

    this.queue = new taskcluster.Queue({
      rootUrl: config.rootUrl,
      credentials: config.taskcluster
    });

    var deadline = new Date();
    deadline.setMinutes(deadline.getMinutes() + 60);

    this.TaskFactory = Task.extend({
      properties: {
        deadline: deadline,
        workerType: this.workerType,
        provisionerId: PROVISIONER_ID,
        metadata: {
          description: 'jonas damn you',
          owner: 'unkown@localhost.local',
          name: 'Task from docker-worker test suite',
          source: 'http://foobar.com'
        }
      }
    });
  }
Example #3
0
var base        = require('taskcluster-base');
var data        = require('../hooks/data');
var taskcluster = require('taskcluster-client');
var taskcreator = require('../hooks/taskcreator');
var testing     = require('taskcluster-lib-testing');
var v1          = require('../routes/v1');
var load        = require('../bin/main');
var config      = require('typed-env-config');
var _           = require('lodash');

var cfg = config({profile: 'test'});


var helper = module.exports = {};

helper.load = load;
helper.loadOptions = {profile: 'test', process: 'test-helper'};

helper.haveRealCredentials = !!cfg.taskcluster.credentials.accessToken;

// Call this in suites or tests that make API calls, hooks etc; it will set up
// what's required to respond to those calls.
helper.setup = function() {
  // Hold reference to authServer
  var authServer = null;
  var webServer = null;

  // Setup before tests
  suiteSetup(async () => {
    testing.fakeauth.start({
      'test-client': ['*'],
Example #4
0
 setup: ({profile}) => Config({profile}),
Example #5
0
 setup: ({profile}) => config({profile}),