Function that checks if keystone is ready before starting testing
430170
function checkKeystoneReady (keystone, done) {
	async.retry({
		times: 10,
		interval: 3000,
	}, function (done, result) {
		console.log([moment().format('HH:mm:ss:SSS')] + ' kne: checking if KeystoneJS ready for request');
		request
			.get('http://' + keystone.get('host') + ':' + keystone.get('port') + '/keystone')
			.end(done);
	}, function (err, result) {
		if (!err) {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: KeystoneJS Ready!');
			done();
		} else {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: KeystoneJS does not appear ready!');
			done(err);
		}
	});
}
399559
function( startFunc ) {
		var self = this,
			message = self.state === munit.ASSERT_STATE_DEFAULT ? "'" + self.nsPath + "' hasn't been triggered yet" :
				self.state === munit.ASSERT_STATE_SETUP ? "'" + self.nsPath + "' is in the setup processs" :
				self.state === munit.ASSERT_STATE_ACTIVE ? "'" + self.nsPath + "' is active" :
				self.state === munit.ASSERT_STATE_TEARDOWN ? "'" + self.nsPath + "' is in the teardown processs" :
				self.state === munit.ASSERT_STATE_CLOSED ? "'" + self.nsPath + "' is closed" :
				self.state === munit.ASSERT_STATE_FINISHED ? "'" + self.nsPath + "' is finished" :
				"'" + self.nsPath + "' is in an unknown state";

		throw new munit.AssertionError( message, startFunc || self._stateError );
	}
1254864
def _preflight_check(desired, fromrepo, **kwargs):
    '''
    
    '''
    if 'pkg.check_db' not in __salt__:
        return {}
    ret = {'suggest': {}, 'no_suggest': []}
    pkginfo = __salt__['pkg.check_db'](
        *list(desired.keys()), fromrepo=fromrepo, **kwargs
    )
    for pkgname in pkginfo:
        if pkginfo[pkgname]['found'] is False:
            if pkginfo[pkgname]['suggestions']:
                ret['suggest'][pkgname] = pkginfo[pkgname]['suggestions']
            else:
                ret['no_suggest'].append(pkgname)
    return ret
677238
def _maybe_wait_for_initializing_instance(instance):
  """"""

  if not instance:
    return

  if instance.state['Name'] == 'initializing':
    while True:
      print(f"Waiting  for {instance} to leave state 'initializing'.")
      instance.reload()
      if instance.state['Name'] == 'running':
        break
      time.sleep(10)
669940
def ready(self):
        ''''''
        if self._last_failed:
            delta = time.time() - self._last_failed
            return delta >= self.backoff()
        return True
835172
def ready(zone):
    '''
    
    '''
    ret = {'status': True}

    ## ready zone
    res = __salt__['cmd.run_all']('zoneadm {zone} ready'.format(
        zone='-u {0}'.format(zone) if _is_uuid(zone) else '-z {0}'.format(zone),
    ))
    ret['status'] = res['retcode'] == 0
    ret['message'] = res['stdout'] if ret['status'] else res['stderr']
    ret['message'] = ret['message'].replace('zoneadm: ', '')
    if ret['message'] == '':
        del ret['message']

    return ret
241908
function isRunning(specs) {
  return specs.dataset.some(coll => {
    return coll.contents.some(e => {
      return ['ready', 'queued', 'running', 'interrupted'].includes(e.status);
    });
  });
}
358213
function suiteStarted() {
		// Have all suites started?
		if(hasPendingSuites()) {
			return;
		}
		// All suites have started, send the total to karma
		let [total, finished] = countTests();
		if(isDebug) {
			console.debug(`All ${Object.keys(suites).length} suites have started, expecting ${total} tests (of which ${finished} have already finished)`);
		}
		karma.info({total});
		// Send the pending results
		pendingResults.forEach(sendResult);
		pendingResults = [];
	}
1102650
def __init_keystone_session_v2(self, check=False):
        """"""
        from keystoneauth1 import loading as keystone_v2
        loader = keystone_v2.get_plugin_loader('password')
        auth = loader.load_from_options(
            auth_url=self._os_auth_url,
            username=self._os_username,
            password=self._os_password,
            project_name=self._os_tenant_name,
        )
        sess = keystoneauth1.session.Session(auth=auth, verify=self._os_cacert)
        if check:
            log.debug("Checking that Keystone API v2 session works...")
            try:
                # if session is invalid, the following will raise some exception
                nova = nova_client.Client(self._compute_api_version, session=sess, cacert=self._os_cacert)
                nova.flavors.list()
            except keystoneauth1.exceptions.NotFound as err:
                log.warning("Creating Keystone v2 session failed: %s", err)
                return None
            except keystoneauth1.exceptions.ClientException as err:
                log.error("OpenStack server rejected request (likely configuration error?): %s", err)
                return None  # FIXME: should we be raising an error instead?
        # if we got to this point, v2 session is valid
        log.info("Using Keystone API v2 session to authenticate to OpenStack")
        return sess
180789
function checkForSpacesAfterAwait(node) {
            const tokens = sourceCode.getFirstTokens(node, 3);

            checkUnaryWordOperatorForSpaces(node, tokens[0], tokens[1], "await");
        }
658887
def check_has(priority=BaseCheck.HIGH, gname=None):
    """"""

    def _inner(func):
        def _dec(s, ds):
            attr_process = kvp_convert(func(s, ds))

            ret_val = []
            # could potentially run tests in parallel if we eliminated side
            # effects on `ret_val`
            for kvp in attr_process.items():
                # function mutates ret_val
                attr_check(kvp, ds, priority, ret_val, gname)
            return ret_val

        return wraps(func)(_dec)

    return _inner
897446
function Live() {

	this._options = {};
	this._live = {
		namespace: {}
	};
	
	this.checkForKeystone = function() {
		if (!this.keystone) {
			console.log('Failed to start keystone-live.  You must include a keystone object with .init(keystone)');
			process.exit();
		}
	}
	
}
449293
def is_ready(self, key):
        """"""
        if self.pending_callbacks is None or key not in self.pending_callbacks:
            raise UnknownKeyError("key %r is not pending" % (key,))
        return key in self.results
1160357
function psec(name, run) {
  const test = { name, run, before: null, after: null }
  ctx.tests.push(test)
  ctx.run()
  return {
    beforeEach(fn) {
      test.before = fn
      return this
    },
    afterEach(fn) {
      test.after = fn
      return this
    },
  }
}
1148869
function isGonnaBeLegen() {
        current = shift.call(queue);
        if (current) {
            if (typeof current == "function") {
                current = {name: current[NAME] || "anonymous", test: current};
            }
            log(OUTPUT_SEPARATOR);
            log(
                (iHasIt(current, NAME) && current[NAME])
                ||
                (iHasIt(current, DESCRIPTION) && current[DESCRIPTION])
                ||
                UNKNOWN
            );
            pass = [];
            fail = [];
            fatal = [];
            tmp = {};
            giveItATry("setup");
            fatal[LENGTH] || giveItATry("test");
            waitForIt || Dary();
        } else {
            showSummary();
        }
    }
278922
def validate_busy(func, *args, **kwargs):
    
    def inner(self, *args, **kwargs):
        # find the target param
        target_id = None
        if 'target_id' in kwargs and kwargs['target_id'] != None:
            target_id = kwargs['target_id']
        else:
            target_id = 0

        # if there was a target specified, ensure it's not busy
        if self.target_is_busy(target_id):
            raise TargetBusyException()

        # call the function
        return func(self, *args, **kwargs)
    return inner
142589
def present(name, auth=None, **kwargs):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}

    kwargs = __utils__['args.clean_kwargs'](**kwargs)

    __salt__['keystoneng.setup_clouds'](auth)

    kwargs['name'] = name
    role = __salt__['keystoneng.role_get'](**kwargs)

    if not role:
        if __opts__['test'] is True:
            ret['result'] = None
            ret['changes'] = kwargs
            ret['comment'] = 'Role will be created.'
            return ret

        role = __salt__['keystoneng.role_create'](**kwargs)
        ret['changes']['id'] = role.id
        ret['changes']['name'] = role.name
        ret['comment'] = 'Created role'
        return ret
    # NOTE(SamYaple): Update support pending https://review.openstack.org/#/c/496992/
    return ret