Minor Adjustments

This commit is contained in:
Dunemask 2023-03-19 13:53:37 -04:00
parent 1084f5d937
commit f486d50efa
60 changed files with 1965 additions and 127 deletions

View file

@ -0,0 +1,19 @@
// Imports
import { Worker } from "rabbiteer";
// Class
export default class KubeJobsWorker extends Worker {
constructor() {
super("KubeJobs");
}
async configure(ch) {
await ch.assertExchange("KubeJobsExchange", "direct");
await ch.assertQueue(this.queue, this.queueOptions);
await ch.bindQueue(this.queue, "KubeJobsExchange", "KubeJobs");
await ch.consume(this.queue, (msg) => this.consume(msg, () => ch.ack(msg)));
}
onMessage(string) {
console.log(`Died: ${string}`);
}
}

View file

@ -0,0 +1,45 @@
// Imports
import { Worker } from "rabbiteer";
import { VERB } from "../../util/logging.js";
import { insertTestResult } from "../../database/queries/results.js";
import evt from "../../../common/sockets/events.js";
// Class
export default class TestResultsWorker extends Worker {
constructor(skio) {
super("TestResults");
this.skio = skio;
}
/* Example Test Result
{
testName: SomeTest,
testClass: SomeClass,
testMethod: SomeMethod,
testType: API/UI,
testTimestamp: 123893024,
origin: TestSuite,
failed: true,
failedMessage: Some Failure,
screenshotUrl: https://screenshot”,
expectedScreenshotUrl: https://expected”
consoleLogUrl: https://consolelog”
}
*/
async onMessage(testResult) {
const { pipeline } = testResult;
await this.handleReporting(testResult);
// Alter to start next test
// TODO the delay should be autopopulated either by the suite, or filled in by the server
if (pipeline) return this.pipelineTrigger(pipeline);
}
pipelineTrigger(pipeline) {
const { dashboardSocketId: dsi } = pipeline;
this.skio.to(dsi).emit(evt.PPL_TRG, pipeline);
}
handleReporting(result) {
VERB("TestResults", result.name);
insertTestResult(result);
}
}

View file

@ -0,0 +1,4 @@
import TestResultsWorker from "./TestResultsWorker.js";
const buildWorkers = (skio) => [new TestResultsWorker(skio)];
export default buildWorkers;