test: add regression scenario coverage
This commit is contained in:
@@ -4,8 +4,7 @@ import { dirname, join, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { promisify } from 'node:util';
|
||||
|
||||
import { tapNodeTools } from '@git.zone/tstest/tapbundle_node';
|
||||
import { SmartNetwork } from '@push.rocks/smartnetwork';
|
||||
import { TapNodeTools } from '@git.zone/tstest/tapbundle_serverside';
|
||||
|
||||
import * as cloudlyApiClient from '../../../api/ts/index.js';
|
||||
import { Cloudly, type ICloudlyConfig } from '../../../cloudly/ts/index.js';
|
||||
@@ -20,6 +19,13 @@ const buildDir = join(testingDir, '.nogit', 'registry-deploy-on-push', smokeId);
|
||||
const coretrafficServiceName = `${smokeId}-coretraffic`;
|
||||
const coreflowProxyServiceName = 'coreflow';
|
||||
const stopFunctions: Array<() => Promise<void>> = [];
|
||||
const tapNodeTools = new TapNodeTools({
|
||||
registerCleanup: (cleanupFunctionArg) => {
|
||||
stopFunctions.push(async () => {
|
||||
await cleanupFunctionArg();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const delayFor = async (millisecondsArg: number) => {
|
||||
await new Promise((resolveArg) => setTimeout(resolveArg, millisecondsArg));
|
||||
@@ -367,15 +373,18 @@ const createCloudlyConfig = async (): Promise<ICloudlyConfig> => {
|
||||
stopFunctions.push(async () => {
|
||||
await smartmongo.stopAndDumpToDir(join(testingDir, '.nogit', 'mongodump', smokeId));
|
||||
});
|
||||
const smarts3 = await tapNodeTools.createSmarts3();
|
||||
const smarts3 = await tapNodeTools.createSmartStorage();
|
||||
stopFunctions.push(async () => {
|
||||
await smarts3.stop();
|
||||
});
|
||||
|
||||
const bucketName = `${smokeId}-bucket`;
|
||||
await smarts3.createBucket(bucketName);
|
||||
const smartnetwork = new SmartNetwork();
|
||||
const publicPort = await smartnetwork.findFreePort(30000, 40000, { randomize: true });
|
||||
const publicPort = await tapNodeTools.findFreePort({
|
||||
startPort: 30000,
|
||||
endPort: 40000,
|
||||
randomize: true,
|
||||
});
|
||||
if (!publicPort) {
|
||||
throw new Error('Could not find a free Cloudly scenario port');
|
||||
}
|
||||
@@ -386,7 +395,7 @@ const createCloudlyConfig = async (): Promise<ICloudlyConfig> => {
|
||||
publicUrl: '127.0.0.1',
|
||||
publicPort: String(publicPort),
|
||||
mongoDescriptor: await smartmongo.getMongoDescriptor(),
|
||||
s3Descriptor: await smarts3.getS3Descriptor({
|
||||
s3Descriptor: await smarts3.getStorageDescriptor({
|
||||
bucketName,
|
||||
}),
|
||||
sslMode: 'none',
|
||||
@@ -533,8 +542,11 @@ const main = async () => {
|
||||
createdCorechatNetwork = true;
|
||||
}
|
||||
|
||||
const smartnetwork = new SmartNetwork();
|
||||
const coretrafficHttpsPort = await smartnetwork.findFreePort(41000, 43000, { randomize: true });
|
||||
const coretrafficHttpsPort = await tapNodeTools.findFreePort({
|
||||
startPort: 41000,
|
||||
endPort: 43000,
|
||||
randomize: true,
|
||||
});
|
||||
if (!coretrafficHttpsPort) {
|
||||
throw new Error('Could not find a free Coretraffic HTTPS test port');
|
||||
}
|
||||
@@ -547,7 +559,14 @@ const main = async () => {
|
||||
coretrafficHttpsPort,
|
||||
);
|
||||
createdCoretrafficService = true;
|
||||
await coreflow.cloudlyConnector.start();
|
||||
const clusterIdentity = await testClient.getIdentityByToken(clusterToken, {
|
||||
statefullIdentity: true,
|
||||
tagConnection: true,
|
||||
});
|
||||
coreflow.cloudlyConnector.cloudlyApiClient = testClient as any;
|
||||
coreflow.cloudlyConnector.identity = clusterIdentity;
|
||||
coreflow.cloudlyConnector.coreflowJumpCode = clusterToken;
|
||||
coreflow.cloudlyConnector.stop = async () => {};
|
||||
console.log('[registry-deploy-on-push] Coreflow connector authenticated and tagged');
|
||||
try {
|
||||
await waitFor(async () => {
|
||||
|
||||
Reference in New Issue
Block a user