Compare commits

..

8 Commits

Author SHA1 Message Date
f80b8decbc 4.3.7
Some checks failed
Docker (tags) / security (push) Successful in 59s
Docker (tags) / test (push) Failing after 2m4s
Docker (tags) / release (push) Has been skipped
Docker (tags) / metadata (push) Has been skipped
2024-11-06 16:53:22 +01:00
28cd6d1b49 fix(tests): Refactored test setup for consistency and isolated config initialization. 2024-11-06 16:53:21 +01:00
899e5b0a7d 4.3.6
Some checks failed
Docker (tags) / security (push) Successful in 55s
Docker (tags) / test (push) Failing after 2m8s
Docker (tags) / release (push) Has been skipped
Docker (tags) / metadata (push) Has been skipped
2024-11-06 16:22:38 +01:00
0eff7c7510 fix(test): Enhance test helpers with dynamic Hetzner token retrieval. 2024-11-06 16:22:38 +01:00
7789348f4e 4.3.5
Some checks failed
Docker (tags) / security (push) Successful in 1m2s
Docker (tags) / test (push) Failing after 2m8s
Docker (tags) / release (push) Has been skipped
Docker (tags) / metadata (push) Has been skipped
2024-11-06 16:13:55 +01:00
66a23a515b fix(helpers): Add missing sslMode configuration to Cloudly config. 2024-11-06 16:13:54 +01:00
7c1082f5a9 4.3.4
Some checks failed
Docker (tags) / security (push) Successful in 1m0s
Docker (tags) / test (push) Failing after 2m5s
Docker (tags) / release (push) Has been skipped
Docker (tags) / metadata (push) Has been skipped
2024-11-06 03:56:46 +01:00
15ea5adec6 fix(testing): Fixed Cloudly testing setup and dependencies 2024-11-06 03:56:46 +01:00
10 changed files with 544 additions and 204 deletions

View File

@ -13,6 +13,7 @@ env:
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}} NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_LOGIN_DOCKER_GITEA: ${{ github.server_url }}|${{ gitea.repository_owner }}|${{ secrets.GITEA_TOKEN }} NPMCI_LOGIN_DOCKER_GITEA: ${{ github.server_url }}|${{ gitea.repository_owner }}|${{ secrets.GITEA_TOKEN }}
NPMCI_LOGIN_DOCKER_DOCKERREGISTRY: ${{ secrets.NPMCI_LOGIN_DOCKER_DOCKERREGISTRY }} NPMCI_LOGIN_DOCKER_DOCKERREGISTRY: ${{ secrets.NPMCI_LOGIN_DOCKER_DOCKERREGISTRY }}
NPMCI_SECRET01: ${{ secrets.NPMCI_SECRET01 }}
jobs: jobs:
security: security:

View File

@ -1,5 +1,30 @@
# Changelog # Changelog
## 2024-11-06 - 4.3.7 - fix(tests)
Refactored test setup for consistency and isolated config initialization.
- test/helpers/cloudlyfactory.ts: Test configuration setup was refactored to ensure consistent initialization of cloudly configuration across tests.
- test/test.apiclient.ts: Updated cloudlyApiClient test setup to use testCloudlyConfig for dynamic port allocation.
## 2024-11-06 - 4.3.6 - fix(test)
Enhance test helpers with dynamic Hetzner token retrieval.
- Updated test/helpers/cloudlyfactory.ts to retrieve Hetzner token from environment variables.
- Expanded docker_tags workflow to securely handle and pass new environment secrets.
## 2024-11-06 - 4.3.5 - fix(helpers)
Add missing sslMode configuration to Cloudly config.
- Added the sslMode key with a value of 'none' to the Cloudly configuration object in test/helpers/cloudlyfactory.ts.
## 2024-11-06 - 4.3.4 - fix(testing)
Fixed Cloudly testing setup and dependencies
- Updated devDependency @push.rocks/tapbundle version from ^5.3.0 to ^5.4.3 in package.json.
- Updated devDependency @push.rocks/npmextra version from ^5.1.1 to ^5.1.2 in package.json.
- Improved the Cloudly test suite setup to ensure proper initialization of MongoDB and S3 services.
- Ensured asynchronous stopping and cleanup of MongoDB and S3 services post-test execution.
## 2024-11-05 - 4.3.3 - fix(core) ## 2024-11-05 - 4.3.3 - fix(core)
Fix configuration initialization by accepting a config argument Fix configuration initialization by accepting a config argument

View File

@ -1,6 +1,6 @@
{ {
"name": "@serve.zone/cloudly", "name": "@serve.zone/cloudly",
"version": "4.3.3", "version": "4.3.7",
"private": false, "private": false,
"description": "A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.", "description": "A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.",
"type": "module", "type": "module",
@ -28,7 +28,7 @@
"@git.zone/tspublish": "^1.7.7", "@git.zone/tspublish": "^1.7.7",
"@git.zone/tstest": "^1.0.90", "@git.zone/tstest": "^1.0.90",
"@git.zone/tswatch": "^2.0.25", "@git.zone/tswatch": "^2.0.25",
"@push.rocks/tapbundle": "^5.3.0", "@push.rocks/tapbundle": "^5.4.3",
"@types/node": "^22.9.0" "@types/node": "^22.9.0"
}, },
"dependencies": { "dependencies": {
@ -45,7 +45,7 @@
"@design.estate/dees-element": "^2.0.39", "@design.estate/dees-element": "^2.0.39",
"@git.zone/tsrun": "^1.3.3", "@git.zone/tsrun": "^1.3.3",
"@push.rocks/early": "^4.0.3", "@push.rocks/early": "^4.0.3",
"@push.rocks/npmextra": "^5.1.1", "@push.rocks/npmextra": "^5.1.2",
"@push.rocks/projectinfo": "^5.0.1", "@push.rocks/projectinfo": "^5.0.1",
"@push.rocks/qenv": "^6.0.5", "@push.rocks/qenv": "^6.0.5",
"@push.rocks/smartacme": "^5.0.0", "@push.rocks/smartacme": "^5.0.0",

649
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,25 +3,46 @@ const testQenv = new Qenv('./', './.nogit/');
import * as cloudly from '../../ts/index.js'; import * as cloudly from '../../ts/index.js';
export const createCloudly = async () => { const stopFunctions: Array<() => Promise<void>> = [];
const cloudlyConfig: cloudly.ICloudlyConfig = {
const tapToolsNodeMod = await import('@push.rocks/tapbundle/node');
const smartmongo = await tapToolsNodeMod.tapNodeTools.createSmartmongo();
stopFunctions.push(async () => {
await smartmongo.stopAndDumpToDir('./.nogit/mongodump');
});
const smarts3 = await tapToolsNodeMod.tapNodeTools.createSmarts3();
await smarts3.createBucket('cloudly-test');
stopFunctions.push(async () => {
await smarts3.stop();
});
export const testCloudlyConfig: cloudly.ICloudlyConfig = {
cfToken: await testQenv.getEnvVarOnDemand('CF_TOKEN'), cfToken: await testQenv.getEnvVarOnDemand('CF_TOKEN'),
environment: 'integration', environment: 'integration',
letsEncryptEmail: 'test@serve.zone', letsEncryptEmail: 'test@serve.zone',
publicUrl: 'localhost', publicUrl: '127.0.0.1',
publicPort: '8080', publicPort: '8080',
mongoDescriptor: { mongoDescriptor: await smartmongo.getMongoDescriptor(),
mongoDbName: await testQenv.getEnvVarOnDemand('MONGODB_DATABASE'), s3Descriptor: await smarts3.getS3Descriptor(),
mongoDbUser: await testQenv.getEnvVarOnDemand('MONGODB_USER'), sslMode: 'none',
mongoDbPass: await testQenv.getEnvVarOnDemand('MONGODB_PASSWORD'), ...(() => {
mongoDbUrl: await testQenv.getEnvVarOnDemand('MONGODB_URL'), if (process.env.NPMCI_SECRET01) {
}, return {
hetznerToken: process.env.NPMCI_SECRET01,
}; };
const cloudlyInstance = new cloudly.Cloudly();
return cloudlyInstance;
} }
})(),
};
export const createCloudly = async () => {
const cloudlyInstance = new cloudly.Cloudly(testCloudlyConfig);
return cloudlyInstance;
};
export const stopCloudly = async () => {
await Promise.all(stopFunctions.map((stopFunction) => stopFunction()));
};
export const getEnvVarOnDemand = async (envVarName: string) => { export const getEnvVarOnDemand = async (envVarName: string) => {
return testQenv.getEnvVarOnDemand(envVarName); return testQenv.getEnvVarOnDemand(envVarName);
} };

View File

@ -33,7 +33,7 @@ tap.preTask('should create a new machine user for testing', async () => {
tap.test('should create a new cloudlyApiClient', async () => { tap.test('should create a new cloudlyApiClient', async () => {
testClient = new cloudlyApiClient.CloudlyApiClient({ testClient = new cloudlyApiClient.CloudlyApiClient({
registerAs: 'api', registerAs: 'api',
cloudlyUrl: `http://localhost:${await helpers.getEnvVarOnDemand('SERVEZONE_PORT')}`, cloudlyUrl: `http://localhost:${helpers.testCloudlyConfig.publicPort}`,
}); });
await testClient.start(); await testClient.start();
expect(testClient).toBeTruthy(); expect(testClient).toBeTruthy();
@ -73,6 +73,7 @@ tap.test('should upload an image version', async () => {
tap.test('should stop the apiclient', async (toolsArg) => { tap.test('should stop the apiclient', async (toolsArg) => {
await toolsArg.delayFor(10000); await toolsArg.delayFor(10000);
await helpers.stopCloudly();
await testClient.stop(); await testClient.stop();
await testCloudly.stop(); await testCloudly.stop();
}) })

View File

@ -14,8 +14,10 @@ tap.test('should init cloudly', async () => {
}); });
tap.test('should end the service', async (tools) => { tap.test('should end the service', async (tools) => {
await tools.delayFor(5000);
await helpers.stopCloudly();
await testCloudly.stop(); await testCloudly.stop();
tools.delayFor(1000).then(() => process.exit()) tools.delayFor(1000).then(() => process.exit());
}); });
tap.start(); tap.start();

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/cloudly', name: '@serve.zone/cloudly',
version: '4.3.3', version: '4.3.7',
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
} }

View File

@ -62,6 +62,7 @@ export class Cloudly {
private configOptions: plugins.servezoneInterfaces.data.ICloudlyConfig; private configOptions: plugins.servezoneInterfaces.data.ICloudlyConfig;
constructor(configArg?: plugins.servezoneInterfaces.data.ICloudlyConfig) { constructor(configArg?: plugins.servezoneInterfaces.data.ICloudlyConfig) {
this.configOptions = configArg;
this.cloudlyInfo = new CloudlyInfo(this); this.cloudlyInfo = new CloudlyInfo(this);
this.config = new CloudlyConfig(this); this.config = new CloudlyConfig(this);

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/cloudly', name: '@serve.zone/cloudly',
version: '4.3.3', version: '4.3.7',
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
} }