fix(testing): Fixed Cloudly testing setup and dependencies
This commit is contained in:
		| @@ -1,5 +1,13 @@ | ||||
| # Changelog | ||||
|  | ||||
| ## 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) | ||||
| Fix configuration initialization by accepting a config argument | ||||
|  | ||||
|   | ||||
| @@ -28,7 +28,7 @@ | ||||
|     "@git.zone/tspublish": "^1.7.7", | ||||
|     "@git.zone/tstest": "^1.0.90", | ||||
|     "@git.zone/tswatch": "^2.0.25", | ||||
|     "@push.rocks/tapbundle": "^5.3.0", | ||||
|     "@push.rocks/tapbundle": "^5.4.3", | ||||
|     "@types/node": "^22.9.0" | ||||
|   }, | ||||
|   "dependencies": { | ||||
| @@ -45,7 +45,7 @@ | ||||
|     "@design.estate/dees-element": "^2.0.39", | ||||
|     "@git.zone/tsrun": "^1.3.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/qenv": "^6.0.5", | ||||
|     "@push.rocks/smartacme": "^5.0.0", | ||||
|   | ||||
							
								
								
									
										649
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										649
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -3,24 +3,36 @@ const testQenv = new Qenv('./', './.nogit/'); | ||||
|  | ||||
| import * as cloudly from '../../ts/index.js'; | ||||
|  | ||||
| const stopFunctions: Array<() => Promise<void>> = []; | ||||
|  | ||||
| export const createCloudly = async () => { | ||||
|   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(); | ||||
|   }); | ||||
|   const cloudlyConfig: cloudly.ICloudlyConfig = { | ||||
|     cfToken: await testQenv.getEnvVarOnDemand('CF_TOKEN'), | ||||
|     environment: 'integration', | ||||
|     letsEncryptEmail: 'test@serve.zone', | ||||
|     publicUrl: 'localhost', | ||||
|     publicPort: '8080', | ||||
|     mongoDescriptor: { | ||||
|       mongoDbName: await testQenv.getEnvVarOnDemand('MONGODB_DATABASE'), | ||||
|       mongoDbUser: await testQenv.getEnvVarOnDemand('MONGODB_USER'), | ||||
|       mongoDbPass: await testQenv.getEnvVarOnDemand('MONGODB_PASSWORD'), | ||||
|       mongoDbUrl: await testQenv.getEnvVarOnDemand('MONGODB_URL'), | ||||
|     }, | ||||
|     mongoDescriptor: await smartmongo.getMongoDescriptor(), | ||||
|     s3Descriptor: await smarts3.getS3Descriptor(), | ||||
|   }; | ||||
|   const cloudlyInstance = new cloudly.Cloudly(); | ||||
|   const cloudlyInstance = new cloudly.Cloudly(cloudlyConfig); | ||||
|   return cloudlyInstance; | ||||
| } | ||||
|  | ||||
| export const stopCloudly = async () => { | ||||
|   await Promise.all(stopFunctions.map((stopFunction) => stopFunction())); | ||||
| }; | ||||
|  | ||||
| export const getEnvVarOnDemand = async (envVarName: string) => { | ||||
|   return testQenv.getEnvVarOnDemand(envVarName); | ||||
| }  | ||||
|   | ||||
| @@ -73,6 +73,7 @@ tap.test('should upload an image version', async () => { | ||||
|  | ||||
| tap.test('should stop the apiclient', async (toolsArg) => { | ||||
|   await toolsArg.delayFor(10000); | ||||
|   await helpers.stopCloudly(); | ||||
|   await testClient.stop(); | ||||
|   await testCloudly.stop(); | ||||
| }) | ||||
|   | ||||
| @@ -14,8 +14,10 @@ tap.test('should init cloudly', async () => { | ||||
| }); | ||||
|  | ||||
| tap.test('should end the service', async (tools) => { | ||||
|   await tools.delayFor(5000); | ||||
|   await helpers.stopCloudly(); | ||||
|   await testCloudly.stop(); | ||||
|   tools.delayFor(1000).then(() => process.exit()) | ||||
|   tools.delayFor(1000).then(() => process.exit()); | ||||
| }); | ||||
|  | ||||
| tap.start(); | ||||
|   | ||||
| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@serve.zone/cloudly', | ||||
|   version: '4.3.3', | ||||
|   version: '4.3.4', | ||||
|   description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' | ||||
| } | ||||
|   | ||||
| @@ -62,6 +62,7 @@ export class Cloudly { | ||||
|  | ||||
|   private configOptions: plugins.servezoneInterfaces.data.ICloudlyConfig; | ||||
|   constructor(configArg?: plugins.servezoneInterfaces.data.ICloudlyConfig) { | ||||
|     this.configOptions = configArg; | ||||
|     this.cloudlyInfo = new CloudlyInfo(this); | ||||
|     this.config = new CloudlyConfig(this); | ||||
|  | ||||
|   | ||||
| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@serve.zone/cloudly', | ||||
|   version: '4.3.3', | ||||
|   version: '4.3.4', | ||||
|   description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user