Browse Source

Add client_name to testrunner protocol

pull/653/head
Sami Vaarala 9 years ago
parent
commit
633a506115
  1. 6
      testrunner/client-simple-node/client.js
  2. 3
      testrunner/client-simple-node/config.yaml.template
  3. 5
      testrunner/server-node/githubutil.js

6
testrunner/client-simple-node/client.js

@ -55,7 +55,7 @@ function getBasicAuthHeader() {
}
function getUserAgent() {
return 'testrunner-client';
return 'testrunner-client ' + clientConfig.clientName;
}
function serverAuthCheck(res) {
@ -73,7 +73,7 @@ function postJson(path, request, cb) {
'User-Agent': getUserAgent(),
'Authorization': getBasicAuthHeader(),
'Content-Type': 'application/json',
'Content-Length': requestData.length,
'Content-Length': requestData.length
};
var options = {
host: clientConfig.serverHost,
@ -291,6 +291,7 @@ function processSimpleScriptJob(rep) {
// XXX: indicate possibly transient nature of error
postJson('/finish-commit-simple', {
client_name: clientConfig.clientName,
repo: assert(repo),
repo_full: assert(repoFull),
repo_clone_url: assert(repoCloneUrl),
@ -321,6 +322,7 @@ function requestAndExecute() {
}
postJson('/get-commit-simple', {
client_name: clientConfig.clientName,
contexts: contexts
}).then(function (rep) {
console.log(rep);

3
testrunner/client-simple-node/config.yaml.template

@ -12,6 +12,9 @@ serverAuthPassword: 'foobarx'
clientAuthUsername: 'foouser'
clientAuthPassword: 'foopass'
# Client name (human readable), should be User-Agent compatible.
clientName: 'test-client'
# Sleeps between successful/failed jobs.
sleepJobSuccess: 10000
sleepJobFailure: 60000

5
testrunner/server-node/githubutil.js

@ -241,7 +241,7 @@ function handleGetCommitRequests(state) {
context: assert(ctx),
state: 'pending',
target_url: 'http://duktape.org/', // XXX: useful temporary URI? web UI job status?
description: 'Running...'
description: 'Running... (' + (client.client_name || 'no client name') + ')'
});
// XXX: error recovery / restart; check for start_time
@ -362,7 +362,8 @@ function makeGetCommitSimpleHandler(state) {
getCommitRequests.push({
time: Date.now(),
res: res,
contexts: assert(body.contexts)
contexts: assert(body.contexts),
client_name: body.client_name
});
handleGetCommitRequests(state);
};

Loading…
Cancel
Save