@onlineapps/conn-orch-validator 2.0.23 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/conn-orch-validator",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.24",
|
|
4
4
|
"description": "Validation orchestrator for OA Drive microservices - coordinates validation across all layers (base, infra, orch, business)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "OnlineApps",
|
|
22
22
|
"license": "PROPRIETARY",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@onlineapps/service-validator-core": "1.0.
|
|
24
|
+
"@onlineapps/service-validator-core": "1.0.10",
|
|
25
25
|
"@onlineapps/runtime-config": "1.0.2",
|
|
26
26
|
"ajv": "^8.12.0",
|
|
27
27
|
"ajv-formats": "^2.1.1",
|
|
@@ -15,7 +15,7 @@ const { resolveHeaders } = require('./utils/resolveHeaders');
|
|
|
15
15
|
class CookbookTestRunner {
|
|
16
16
|
constructor(options = {}) {
|
|
17
17
|
this.serviceName = options.serviceName;
|
|
18
|
-
this.serviceUrl = options.serviceUrl || 'http://
|
|
18
|
+
this.serviceUrl = options.serviceUrl || 'http://127.0.0.1:3000';
|
|
19
19
|
this.servicePath = options.servicePath;
|
|
20
20
|
this.mockInfrastructure = options.mockInfrastructure !== false; // default true
|
|
21
21
|
this.timeout = options.timeout || 30000;
|
|
@@ -87,7 +87,7 @@ class ServiceTestHarness {
|
|
|
87
87
|
return new Promise((resolve) => {
|
|
88
88
|
this.server = this.service.listen(this.port, () => {
|
|
89
89
|
const actualPort = this.server.address().port;
|
|
90
|
-
this.baseUrl = `http://
|
|
90
|
+
this.baseUrl = `http://127.0.0.1:${actualPort}`;
|
|
91
91
|
resolve();
|
|
92
92
|
});
|
|
93
93
|
});
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { ValidationProofCodec } = require('@onlineapps/service-validator-core');
|
|
6
|
+
const FingerprintUtils = require('@onlineapps/service-validator-core').FingerprintUtils;
|
|
6
7
|
const { ServiceStructureValidator } = require('./validators/ServiceStructureValidator');
|
|
7
8
|
const ServiceReadinessValidator = require('./ServiceReadinessValidator');
|
|
8
9
|
const CookbookTestRunner = require('./CookbookTestRunner');
|
|
@@ -133,6 +134,9 @@ class ValidationOrchestrator {
|
|
|
133
134
|
const configFile = path.join(this.configPath, 'config.json');
|
|
134
135
|
const operationsFile = path.join(this.configPath, 'operations.json');
|
|
135
136
|
const packageFile = path.join(this.serviceRoot, 'package.json');
|
|
137
|
+
const dockerFile = path.join(this.serviceRoot, 'Dockerfile');
|
|
138
|
+
const dockerComposeFile = path.join(this.serviceRoot, 'docker-compose.yml');
|
|
139
|
+
const envExampleFile = path.join(this.serviceRoot, '.env.example');
|
|
136
140
|
|
|
137
141
|
if (!fs.existsSync(configFile)) {
|
|
138
142
|
throw new Error('config.json not found');
|
|
@@ -142,6 +146,18 @@ class ValidationOrchestrator {
|
|
|
142
146
|
const operations = JSON.parse(fs.readFileSync(operationsFile, 'utf8'));
|
|
143
147
|
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf8'));
|
|
144
148
|
|
|
149
|
+
// Include infra file contents in fingerprint to detect changes in environment/setup
|
|
150
|
+
const infra = {};
|
|
151
|
+
if (fs.existsSync(dockerFile)) {
|
|
152
|
+
infra.dockerfile = fs.readFileSync(dockerFile, 'utf8');
|
|
153
|
+
}
|
|
154
|
+
if (fs.existsSync(dockerComposeFile)) {
|
|
155
|
+
infra.dockerCompose = fs.readFileSync(dockerComposeFile, 'utf8');
|
|
156
|
+
}
|
|
157
|
+
if (fs.existsSync(envExampleFile)) {
|
|
158
|
+
infra.envExample = fs.readFileSync(envExampleFile, 'utf8');
|
|
159
|
+
}
|
|
160
|
+
|
|
145
161
|
// Extract @onlineapps/* dependencies
|
|
146
162
|
const deps = {};
|
|
147
163
|
if (pkg.dependencies) {
|
|
@@ -152,18 +168,16 @@ class ValidationOrchestrator {
|
|
|
152
168
|
});
|
|
153
169
|
}
|
|
154
170
|
|
|
155
|
-
// Generate fingerprint using
|
|
171
|
+
// Generate fingerprint using FingerprintUtils (handles deep sorting)
|
|
156
172
|
const fingerprintData = {
|
|
157
173
|
serviceVersion: config.service?.version || pkg.version,
|
|
158
174
|
operations: operations,
|
|
159
175
|
dependencies: deps,
|
|
160
|
-
config: config
|
|
176
|
+
config: config,
|
|
177
|
+
infra: infra
|
|
161
178
|
};
|
|
162
179
|
|
|
163
|
-
|
|
164
|
-
const hashInput = JSON.stringify(fingerprintData, Object.keys(fingerprintData).sort());
|
|
165
|
-
const crypto = require('crypto');
|
|
166
|
-
return crypto.createHash('sha256').update(hashInput).digest('hex');
|
|
180
|
+
return FingerprintUtils.generate(fingerprintData);
|
|
167
181
|
} catch (error) {
|
|
168
182
|
throw new Error(`Failed to calculate fingerprint: ${error.message}`);
|
|
169
183
|
}
|
|
@@ -87,7 +87,7 @@ function createServiceReadinessTests(testsDir, options = {}) {
|
|
|
87
87
|
// Start service for testing
|
|
88
88
|
server = await new Promise((resolve) => {
|
|
89
89
|
const srv = app.listen(testPort, () => {
|
|
90
|
-
baseUrl = `http://
|
|
90
|
+
baseUrl = `http://127.0.0.1:${testPort}`;
|
|
91
91
|
console.log(`\n✓ Test server started: ${baseUrl}\n`);
|
|
92
92
|
resolve(srv);
|
|
93
93
|
});
|
|
@@ -24,7 +24,7 @@ class MockRegistry {
|
|
|
24
24
|
this.services[name] = {
|
|
25
25
|
name,
|
|
26
26
|
version: version || '1.0.0',
|
|
27
|
-
url: url || `http://
|
|
27
|
+
url: url || `http://127.0.0.1:3000`,
|
|
28
28
|
healthCheck: healthCheck || '/health',
|
|
29
29
|
openapi: openapi || {},
|
|
30
30
|
registeredAt: Date.now(),
|