Fixed gitignore
This commit is contained in:
parent
338000684b
commit
61072ee032
16 changed files with 721 additions and 1 deletions
59
lib/jobs/job-builder.js
Normal file
59
lib/jobs/job-builder.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
const baseCommand = "node";
|
||||
const suiteEntry = "tests/assets/suite/runner.js";
|
||||
const pipelineMapping = [
|
||||
{
|
||||
id: 0,
|
||||
pipeline: [{ name: "primary" }, { name: "secondary", delay: 5000 }],
|
||||
},
|
||||
];
|
||||
|
||||
const buildCommon = (jobRequest) => {
|
||||
const { testName } = jobRequest;
|
||||
if (!testName) throw Error("'testName' must be provided!");
|
||||
const command = [baseCommand, suiteEntry, `test=${testName}`];
|
||||
|
||||
// Apply Common Flags
|
||||
command.push("isRetry=false");
|
||||
|
||||
// Return new request
|
||||
return { ...jobRequest, command };
|
||||
};
|
||||
|
||||
const buildSingle = (jobReq) => jobReq;
|
||||
|
||||
const buildMarker = (jobReq) => {};
|
||||
|
||||
const buildProject = (jobReq) => {};
|
||||
|
||||
const pipelineMaxLife = (testName) => {
|
||||
const pipelines = pipelineMapping
|
||||
.filter((m) => m.pipeline.find((t) => t.name === testName))
|
||||
.map((m) => m.pipeline);
|
||||
return Math.max(pipelines.map((p) => p.length)) + 1;
|
||||
};
|
||||
|
||||
const buildCompound = (jobReq, socketId) => {
|
||||
const { testName, command } = jobReq;
|
||||
const pipelineTriggers = jobReq.pipelineTriggers;
|
||||
if (pipelineTriggers) command.push(`pipelineTriggers=${pipelineTriggers}`);
|
||||
command.push(`pipelineDashboardSocket=${socketId}`);
|
||||
return { ...jobReq, command };
|
||||
};
|
||||
|
||||
function nextCompound(previousTest) {}
|
||||
|
||||
export default function jobBuilder(jobRequest, id) {
|
||||
const jobReq = buildCommon(jobRequest, id);
|
||||
switch (jobRequest.type) {
|
||||
case "single":
|
||||
return buildSingle(jobReq);
|
||||
case "marker":
|
||||
return buildMarker(jobReq);
|
||||
case "project":
|
||||
return buildProject(jobReq);
|
||||
case "compound":
|
||||
return buildCompound(jobReq, id);
|
||||
default:
|
||||
throw Error("No Job Request Type Specified!");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue