mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-20 16:07:11 +08:00
fix(ci): track restarted provider evidence
This commit is contained in:
@@ -5,10 +5,12 @@
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const {
|
||||
postgresqlControlSchemaContract,
|
||||
postgresqlMainMigrationStream,
|
||||
} = require('../packages/ql3-cluster-postgres/dist/migration/migration.js');
|
||||
|
||||
const FIXTURE = 'qinglong/plugin-package-recovery-e2e-live-contract@v3';
|
||||
const CONTRACT_VERSION = postgresqlControlSchemaContract.contractVersion;
|
||||
const MIGRATION_COUNT = postgresqlMainMigrationStream.migrations.length;
|
||||
const LIMITATIONS = Object.freeze([
|
||||
'isolated PostgreSQL uses explicit TLS disable; production manifests remain verify-full',
|
||||
@@ -274,7 +276,7 @@ function validatePluginPackageRecoveryE2ELiveReport(report) {
|
||||
if (
|
||||
!exactKeys(database, databaseKeys) ||
|
||||
database?.migrationCount !== MIGRATION_COUNT ||
|
||||
database?.capabilityVersion !== 64 ||
|
||||
database?.capabilityVersion !== CONTRACT_VERSION ||
|
||||
database?.initialState !== 'active' ||
|
||||
database?.upgradeState !== 'failed' ||
|
||||
!SHA256.test(database?.initialActiveLockDigest ?? '') ||
|
||||
@@ -488,6 +490,7 @@ if (require.main === module) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
CONTRACT_VERSION,
|
||||
FIXTURE,
|
||||
GATE_KEYS,
|
||||
LIMITATIONS,
|
||||
|
||||
@@ -15,6 +15,7 @@ const {
|
||||
createFixture,
|
||||
} = require('./ql3-plugin-package-recovery-e2e-fixture.cjs');
|
||||
const {
|
||||
CONTRACT_VERSION,
|
||||
MIGRATION_COUNT,
|
||||
} = require('./ql3-plugin-package-recovery-e2e-live-audit.cjs');
|
||||
|
||||
@@ -1287,7 +1288,7 @@ SELECT json_build_object(
|
||||
).stdout;
|
||||
const value = JSON.parse(output);
|
||||
assert.equal(value.migrationCount, MIGRATION_COUNT);
|
||||
assert.equal(value.capabilityVersion, 64);
|
||||
assert.equal(value.capabilityVersion, CONTRACT_VERSION);
|
||||
assert.equal(value.initialState, 'active');
|
||||
assert.equal(value.initialActiveLockDigest, fixture.initial.lock.lockDigest);
|
||||
assert.equal(value.upgradeState, 'failed');
|
||||
|
||||
@@ -289,6 +289,18 @@ function providerPods(fixture) {
|
||||
]).items;
|
||||
}
|
||||
|
||||
function providerObservationKey(pod) {
|
||||
assert.match(pod?.metadata?.uid ?? '', /^[A-Za-z0-9][A-Za-z0-9._-]+$/);
|
||||
const provider = pod?.status?.containerStatuses?.find(
|
||||
(container) => container.name === 'provider',
|
||||
);
|
||||
assert.ok(provider);
|
||||
assert.ok(
|
||||
Number.isSafeInteger(provider.restartCount) && provider.restartCount >= 0,
|
||||
);
|
||||
return `${pod.metadata.uid}:${provider.restartCount}`;
|
||||
}
|
||||
|
||||
function applyExecutorNetworkPolicy(fixture, providerPodIp) {
|
||||
const egress = [
|
||||
{
|
||||
@@ -1604,10 +1616,11 @@ async function main() {
|
||||
providerPodIp: pod.status.podIP,
|
||||
});
|
||||
const count = evidence.requestCount;
|
||||
const previous = requestObservations.get(pod.metadata.uid) ?? 0;
|
||||
const observationKey = providerObservationKey(pod);
|
||||
const previous = requestObservations.get(observationKey) ?? 0;
|
||||
assert.ok(count >= previous);
|
||||
observedProviderRequests += count - previous;
|
||||
requestObservations.set(pod.metadata.uid, count);
|
||||
requestObservations.set(observationKey, count);
|
||||
};
|
||||
|
||||
applyExecutorNetworkPolicy(fixture, null);
|
||||
@@ -2049,6 +2062,7 @@ module.exports = {
|
||||
canI,
|
||||
deployProvider,
|
||||
executorJob,
|
||||
providerObservationKey,
|
||||
providerServerSource,
|
||||
terminalJobSnapshot,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user