feat(tapnodetools): Add TestFileProvider for handling Docker Alpine image
This commit is contained in:
		| @@ -1,5 +1,11 @@ | ||||
| # Changelog | ||||
|  | ||||
| ## 2024-11-06 - 5.5.0 - feat(tapnodetools) | ||||
| Add TestFileProvider for handling Docker Alpine image | ||||
|  | ||||
| - Introduced TestFileProvider in TapNodeTools. | ||||
| - Added method to retrieve Docker Alpine image as a local tarball. | ||||
|  | ||||
| ## 2024-11-06 - 5.4.4 - fix(dependencies) | ||||
| Update smarts3 dependency to version 2.2.5 | ||||
|  | ||||
|   | ||||
| @@ -31,9 +31,12 @@ | ||||
|     "@push.rocks/smartdelay": "^3.0.5", | ||||
|     "@push.rocks/smartenv": "^5.0.12", | ||||
|     "@push.rocks/smartexpect": "^1.2.1", | ||||
|     "@push.rocks/smartfile": "^11.0.21", | ||||
|     "@push.rocks/smartjson": "^5.0.20", | ||||
|     "@push.rocks/smartmongo": "^2.0.10", | ||||
|     "@push.rocks/smartpath": "^5.0.18", | ||||
|     "@push.rocks/smartpromise": "^4.0.4", | ||||
|     "@push.rocks/smartrequest": "^2.0.23", | ||||
|     "@push.rocks/smarts3": "^2.2.5", | ||||
|     "@push.rocks/smartshell": "^3.0.6", | ||||
|     "@push.rocks/smarttime": "^4.0.8" | ||||
|   | ||||
							
								
								
									
										25
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										25
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							| @@ -26,15 +26,24 @@ dependencies: | ||||
|   '@push.rocks/smartexpect': | ||||
|     specifier: ^1.2.1 | ||||
|     version: 1.2.1 | ||||
|   '@push.rocks/smartfile': | ||||
|     specifier: ^11.0.21 | ||||
|     version: 11.0.21 | ||||
|   '@push.rocks/smartjson': | ||||
|     specifier: ^5.0.20 | ||||
|     version: 5.0.20 | ||||
|   '@push.rocks/smartmongo': | ||||
|     specifier: ^2.0.10 | ||||
|     version: 2.0.10(@aws-sdk/client-sso-oidc@3.682.0) | ||||
|   '@push.rocks/smartpath': | ||||
|     specifier: ^5.0.18 | ||||
|     version: 5.0.18 | ||||
|   '@push.rocks/smartpromise': | ||||
|     specifier: ^4.0.4 | ||||
|     version: 4.0.4 | ||||
|   '@push.rocks/smartrequest': | ||||
|     specifier: ^2.0.23 | ||||
|     version: 2.0.23 | ||||
|   '@push.rocks/smarts3': | ||||
|     specifier: ^2.2.5 | ||||
|     version: 2.2.5 | ||||
| @@ -108,7 +117,7 @@ packages: | ||||
|       '@push.rocks/smartopen': 2.0.0 | ||||
|       '@push.rocks/smartpath': 5.0.18 | ||||
|       '@push.rocks/smartpromise': 4.0.4 | ||||
|       '@push.rocks/smartrequest': 2.0.22 | ||||
|       '@push.rocks/smartrequest': 2.0.23 | ||||
|       '@push.rocks/smartrx': 3.0.7 | ||||
|       '@push.rocks/smartsitemap': 2.0.3 | ||||
|       '@push.rocks/smartstream': 3.2.4 | ||||
| @@ -1733,7 +1742,7 @@ packages: | ||||
|       '@push.rocks/smartfile': 10.0.41 | ||||
|       '@push.rocks/smartpath': 5.0.18 | ||||
|       '@push.rocks/smartpromise': 4.0.4 | ||||
|       '@push.rocks/smartrequest': 2.0.22 | ||||
|       '@push.rocks/smartrequest': 2.0.23 | ||||
|       '@push.rocks/smartrx': 3.0.7 | ||||
|       '@push.rocks/smartstream': 2.0.8 | ||||
|       '@push.rocks/smartunique': 3.0.9 | ||||
| @@ -1903,7 +1912,7 @@ packages: | ||||
|       '@push.rocks/smartmime': 1.0.6 | ||||
|       '@push.rocks/smartpath': 5.0.18 | ||||
|       '@push.rocks/smartpromise': 4.0.4 | ||||
|       '@push.rocks/smartrequest': 2.0.22 | ||||
|       '@push.rocks/smartrequest': 2.0.23 | ||||
|       '@push.rocks/smartstream': 2.0.8 | ||||
|       '@types/fs-extra': 11.0.4 | ||||
|       '@types/glob': 8.1.0 | ||||
| @@ -1924,7 +1933,7 @@ packages: | ||||
|       '@push.rocks/smartmime': 2.0.2 | ||||
|       '@push.rocks/smartpath': 5.0.18 | ||||
|       '@push.rocks/smartpromise': 4.0.4 | ||||
|       '@push.rocks/smartrequest': 2.0.22 | ||||
|       '@push.rocks/smartrequest': 2.0.23 | ||||
|       '@push.rocks/smartstream': 3.2.4 | ||||
|       '@types/fs-extra': 11.0.4 | ||||
|       '@types/glob': 8.1.0 | ||||
| @@ -1937,7 +1946,7 @@ packages: | ||||
|     resolution: {integrity: sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==} | ||||
|     dependencies: | ||||
|       '@push.rocks/smartpromise': 4.0.4 | ||||
|       '@push.rocks/smartrequest': 2.0.22 | ||||
|       '@push.rocks/smartrequest': 2.0.23 | ||||
|  | ||||
|   /@push.rocks/smarthash@3.0.4: | ||||
|     resolution: {integrity: sha512-HJ/fSx41jm0CvSaqMLa6b2nuNK5rHAqAeAq3dAB7Sq9BCPm2M0J5ZVDTzEAH8pS91XYniUiwuE0jwPERNn9hmw==} | ||||
| @@ -2063,7 +2072,7 @@ packages: | ||||
|       '@push.rocks/smartfile': 10.0.41 | ||||
|       '@push.rocks/smartpath': 5.0.18 | ||||
|       '@push.rocks/smartpromise': 4.0.4 | ||||
|       '@push.rocks/smartrequest': 2.0.22 | ||||
|       '@push.rocks/smartrequest': 2.0.23 | ||||
|       '@push.rocks/smarttime': 4.0.8 | ||||
|       '@push.rocks/smartversion': 3.0.5 | ||||
|       package-json: 8.1.1 | ||||
| @@ -2137,8 +2146,8 @@ packages: | ||||
|       - utf-8-validate | ||||
|     dev: true | ||||
|  | ||||
|   /@push.rocks/smartrequest@2.0.22: | ||||
|     resolution: {integrity: sha512-EfgmdEsLtDJ8aNOLOh59ca1NMsiiFz54aoHRigQFQ0cuoUs6phxejIY2FdMoPFn68ubTpkztdL2P4L1/cRYyHg==} | ||||
|   /@push.rocks/smartrequest@2.0.23: | ||||
|     resolution: {integrity: sha512-y+gtOwXFpmPL+mIQblYPdFuHufxHi5lMV0LKm5bPYgGdMq3/+QlnEqNEAumeMHjvXgxur7x30QiHSwpJGK5g9w==} | ||||
|     dependencies: | ||||
|       '@push.rocks/smartpromise': 4.0.4 | ||||
|       '@push.rocks/smarturl': 3.1.0 | ||||
|   | ||||
| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@push.rocks/tapbundle', | ||||
|   version: '5.4.4', | ||||
|   version: '5.5.0', | ||||
|   description: 'A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.' | ||||
| } | ||||
|   | ||||
| @@ -1,7 +1,9 @@ | ||||
| import { TestFileProvider } from './classes.testfileprovider.js'; | ||||
| import * as plugins from './plugins.js'; | ||||
|  | ||||
| class TapNodeTools { | ||||
|   private smartshellInstance: plugins.smartshell.Smartshell; | ||||
|   public testFileProvider = new TestFileProvider(); | ||||
|  | ||||
|   constructor() {} | ||||
|  | ||||
|   | ||||
							
								
								
									
										17
									
								
								ts_node/classes.testfileprovider.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								ts_node/classes.testfileprovider.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import * as plugins from './plugins.js'; | ||||
| import * as paths from './paths.js'; | ||||
|  | ||||
| export const fileUrls = { | ||||
|   dockerAlpineImage: 'https://code.foss.global/testassets/docker/raw/branch/main/alpine.tar', | ||||
| } | ||||
|  | ||||
| export class TestFileProvider { | ||||
|   public async getDockerAlpineImageAsLocalTarball(): Promise<string> { | ||||
|     const filePath = plugins.path.join(paths.testFilesDir, 'alpine.tar') | ||||
|     // fetch the docker alpine image | ||||
|     const response = await plugins.smartrequest.getBinary(fileUrls.dockerAlpineImage); | ||||
|     await plugins.smartfile.fs.ensureDir(paths.testFilesDir); | ||||
|     const AlpineBuffer = await plugins.smartfile.memory.toFs(response.body, filePath); | ||||
|     return filePath; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										4
									
								
								ts_node/paths.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								ts_node/paths.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| import * as plugins from './plugins.js'; | ||||
|  | ||||
| export const cwd = process.cwd(); | ||||
| export const testFilesDir = plugins.path.join(cwd, './.nogit/testfiles/'); | ||||
| @@ -1,12 +1,16 @@ | ||||
| // node native | ||||
| import * as crypto from 'crypto'; | ||||
| import * as fs from 'fs'; | ||||
| import * as path from 'path'; | ||||
|  | ||||
| export { crypto,fs }; | ||||
| export { crypto,fs, path, }; | ||||
|  | ||||
| // @push.rocks scope | ||||
| import * as qenv from '@push.rocks/qenv'; | ||||
| import * as smartcrypto from '@push.rocks/smartcrypto'; | ||||
| import * as smartfile from '@push.rocks/smartfile'; | ||||
| import * as smartpath from '@push.rocks/smartpath'; | ||||
| import * as smartrequest from '@push.rocks/smartrequest'; | ||||
| import * as smartshell from '@push.rocks/smartshell'; | ||||
|  | ||||
| export { qenv, smartcrypto, smartshell }; | ||||
| export { qenv, smartcrypto, smartfile, smartpath, smartrequest, smartshell, }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user