fix: rebaseline M2 DEV smoke endpoints (#77)
* feat: add hwlab dev console homepage * fix: rebaseline M2 DEV smoke endpoints --------- Co-authored-by: HWLAB Code Queue <code-queue@pikastech.local>
This commit is contained in:
@@ -91,6 +91,19 @@ const requiredDevEdgeDocs = [
|
||||
"docs/m0-contract-audit.md",
|
||||
"docs/dev-edge-health.md"
|
||||
];
|
||||
const requiredDevM2Issue = "pikasTech/HWLAB#23";
|
||||
const requiredDevM2ValidationCommands = [
|
||||
"node --check scripts/m2-dev-deploy-smoke.mjs",
|
||||
"node scripts/m2-dev-deploy-smoke.mjs --dry-run",
|
||||
"node scripts/m2-dev-deploy-smoke.mjs --live --confirm-dev --confirmed-non-production --write-report",
|
||||
"node --check scripts/validate-dev-gate-report.mjs",
|
||||
"node scripts/validate-dev-gate-report.mjs"
|
||||
];
|
||||
const requiredDevM2Docs = [
|
||||
"docs/m2-dev-deploy-smoke.md",
|
||||
"docs/dev-acceptance-matrix.md",
|
||||
"fixtures/dev-deploy-smoke/dev-deploy-smoke.json"
|
||||
];
|
||||
const reportFamilyTemplates = new Map([
|
||||
[
|
||||
"dev-gate-report-contract",
|
||||
@@ -353,6 +366,10 @@ async function validateReport(relativePath) {
|
||||
await validateDevEdgeReport(report, label);
|
||||
return;
|
||||
}
|
||||
if (report.issue === requiredDevM2Issue || report.taskId === "m2-dev-deploy-smoke") {
|
||||
await validateDevM2Report(report, label);
|
||||
return;
|
||||
}
|
||||
|
||||
const template = reportFamilyTemplates.get(report.taskId);
|
||||
assert.ok(
|
||||
@@ -949,6 +966,128 @@ async function validateDevEdgeReport(report, label) {
|
||||
assertObject(report.edgeHealth.kubernetes ?? {}, `${label}.edgeHealth.kubernetes`);
|
||||
}
|
||||
|
||||
async function validateDevM2Report(report, label) {
|
||||
for (const field of [
|
||||
"$schema",
|
||||
"$id",
|
||||
"reportVersion",
|
||||
"issue",
|
||||
"taskId",
|
||||
"commitId",
|
||||
"acceptanceLevel",
|
||||
"devOnly",
|
||||
"prodDisabled",
|
||||
"status",
|
||||
"generatedAt",
|
||||
"endpoint",
|
||||
"frontendEndpoint",
|
||||
"sourceContract",
|
||||
"validationCommands",
|
||||
"localSmoke",
|
||||
"dryRun",
|
||||
"devPreconditions",
|
||||
"blockers",
|
||||
"runtimeSmoke"
|
||||
]) {
|
||||
assert.ok(Object.hasOwn(report, field), `${label} missing ${field}`);
|
||||
}
|
||||
|
||||
assertString(report.$schema, `${label}.$schema`);
|
||||
assertString(report.$id, `${label}.$id`);
|
||||
assert.equal(report.reportVersion, "v1", `${label}.reportVersion`);
|
||||
assert.equal(report.issue, requiredDevM2Issue, `${label}.issue`);
|
||||
assert.equal(report.taskId, "m2-dev-deploy-smoke", `${label}.taskId`);
|
||||
assert.match(report.commitId, /^([a-f0-9]{7,40}|unknown)$/, `${label}.commitId`);
|
||||
assert.equal(report.acceptanceLevel, "dev_m2_deploy_smoke", `${label}.acceptanceLevel`);
|
||||
assert.equal(report.devOnly, true, `${label}.devOnly`);
|
||||
assert.equal(report.prodDisabled, true, `${label}.prodDisabled`);
|
||||
assert.equal(report.status, "pass", `${label}.status`);
|
||||
assertTimestamp(report.generatedAt, `${label}.generatedAt`);
|
||||
assert.equal(report.endpoint, "http://74.48.78.17:16667", `${label}.endpoint`);
|
||||
assert.equal(report.frontendEndpoint, "http://74.48.78.17:16666", `${label}.frontendEndpoint`);
|
||||
|
||||
assertObject(report.sourceContract, `${label}.sourceContract`);
|
||||
assertStatus(report.sourceContract.status, `${label}.sourceContract.status`);
|
||||
await assertDocumentSet(
|
||||
report.sourceContract.documents,
|
||||
`${label}.sourceContract.documents`,
|
||||
requiredDevM2Docs
|
||||
);
|
||||
assertString(report.sourceContract.summary, `${label}.sourceContract.summary`);
|
||||
|
||||
assertStringArray(report.validationCommands, `${label}.validationCommands`, {
|
||||
minLength: requiredDevM2ValidationCommands.length
|
||||
});
|
||||
assertUnique(report.validationCommands, `${label}.validationCommands`);
|
||||
for (const requiredCommand of requiredDevM2ValidationCommands) {
|
||||
assert.ok(
|
||||
report.validationCommands.includes(requiredCommand),
|
||||
`${label}.validationCommands missing ${requiredCommand}`
|
||||
);
|
||||
}
|
||||
|
||||
for (const section of ["localSmoke", "dryRun", "devPreconditions"]) {
|
||||
assertObject(report[section], `${label}.${section}`);
|
||||
assertStatus(report[section].status, `${label}.${section}.status`);
|
||||
assertStringArray(report[section].commands, `${label}.${section}.commands`, { minLength: 1 });
|
||||
assertStringArray(report[section].evidence, `${label}.${section}.evidence`, { minLength: 1 });
|
||||
assertString(report[section].summary, `${label}.${section}.summary`);
|
||||
}
|
||||
assertStringArray(report.devPreconditions.requirements, `${label}.devPreconditions.requirements`, {
|
||||
minLength: 1
|
||||
});
|
||||
for (const command of [
|
||||
"curl -fsS --max-time 10 http://74.48.78.17:16667/health",
|
||||
"curl -fsS --max-time 10 http://74.48.78.17:16667/health/live",
|
||||
"curl -fsS --max-time 10 http://74.48.78.17:16666/"
|
||||
]) {
|
||||
assert.ok(
|
||||
report.devPreconditions.commands.includes(command),
|
||||
`${label}.devPreconditions.commands missing ${command}`
|
||||
);
|
||||
}
|
||||
assertBlockers(report.blockers, `${label}.blockers`);
|
||||
|
||||
assertObject(report.runtimeSmoke, `${label}.runtimeSmoke`);
|
||||
assert.equal(report.runtimeSmoke.mode, "live-read-only", `${label}.runtimeSmoke.mode`);
|
||||
assert.equal(report.runtimeSmoke.status, "pass", `${label}.runtimeSmoke.status`);
|
||||
assertTimestamp(report.runtimeSmoke.generatedAt, `${label}.runtimeSmoke.generatedAt`);
|
||||
assert.equal(report.runtimeSmoke.apiEndpoint, "http://74.48.78.17:16667", `${label}.runtimeSmoke.apiEndpoint`);
|
||||
assert.equal(report.runtimeSmoke.frontendEndpoint, "http://74.48.78.17:16666", `${label}.runtimeSmoke.frontendEndpoint`);
|
||||
|
||||
assertObject(report.runtimeSmoke.safety, `${label}.runtimeSmoke.safety`);
|
||||
assert.equal(report.runtimeSmoke.safety.environment, "dev", `${label}.runtimeSmoke.safety.environment`);
|
||||
for (const field of [
|
||||
"prodTouched",
|
||||
"secretsRead",
|
||||
"restarts",
|
||||
"deployAttempted",
|
||||
"heavyE2E",
|
||||
"unideskRuntimeSubstitute"
|
||||
]) {
|
||||
assert.equal(report.runtimeSmoke.safety[field], false, `${label}.runtimeSmoke.safety.${field}`);
|
||||
}
|
||||
|
||||
assertArray(report.runtimeSmoke.probes, `${label}.runtimeSmoke.probes`);
|
||||
assert.ok(report.runtimeSmoke.probes.length >= 3, `${label}.runtimeSmoke.probes must include api and frontend probes`);
|
||||
assertObject(report.runtimeSmoke.legacyPublicEndpoint, `${label}.runtimeSmoke.legacyPublicEndpoint`);
|
||||
assert.equal(
|
||||
report.runtimeSmoke.legacyPublicEndpoint.endpoint,
|
||||
"http://74.48.78.17:6667",
|
||||
`${label}.runtimeSmoke.legacyPublicEndpoint.endpoint`
|
||||
);
|
||||
assert.equal(
|
||||
report.runtimeSmoke.legacyPublicEndpoint.status,
|
||||
"deprecated",
|
||||
`${label}.runtimeSmoke.legacyPublicEndpoint.status`
|
||||
);
|
||||
assert.equal(
|
||||
report.runtimeSmoke.legacyPublicEndpoint.activeGreenEligible,
|
||||
false,
|
||||
`${label}.runtimeSmoke.legacyPublicEndpoint.activeGreenEligible`
|
||||
);
|
||||
}
|
||||
|
||||
async function validateDevM3Report(report, label) {
|
||||
for (const field of [
|
||||
"$schema",
|
||||
|
||||
Reference in New Issue
Block a user