feat(tapnodetools): Add TestFileProvider for handling Docker Alpine image

This commit is contained in:
Philipp Kunz 2024-11-06 21:07:05 +01:00
parent c54493ddbc
commit 36903d2d6c
8 changed files with 56 additions and 11 deletions

View File

@ -1,5 +1,11 @@
# Changelog # 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) ## 2024-11-06 - 5.4.4 - fix(dependencies)
Update smarts3 dependency to version 2.2.5 Update smarts3 dependency to version 2.2.5

View File

@ -31,9 +31,12 @@
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartenv": "^5.0.12", "@push.rocks/smartenv": "^5.0.12",
"@push.rocks/smartexpect": "^1.2.1", "@push.rocks/smartexpect": "^1.2.1",
"@push.rocks/smartfile": "^11.0.21",
"@push.rocks/smartjson": "^5.0.20", "@push.rocks/smartjson": "^5.0.20",
"@push.rocks/smartmongo": "^2.0.10", "@push.rocks/smartmongo": "^2.0.10",
"@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartpromise": "^4.0.4", "@push.rocks/smartpromise": "^4.0.4",
"@push.rocks/smartrequest": "^2.0.23",
"@push.rocks/smarts3": "^2.2.5", "@push.rocks/smarts3": "^2.2.5",
"@push.rocks/smartshell": "^3.0.6", "@push.rocks/smartshell": "^3.0.6",
"@push.rocks/smarttime": "^4.0.8" "@push.rocks/smarttime": "^4.0.8"

25
pnpm-lock.yaml generated
View File

@ -26,15 +26,24 @@ dependencies:
'@push.rocks/smartexpect': '@push.rocks/smartexpect':
specifier: ^1.2.1 specifier: ^1.2.1
version: 1.2.1 version: 1.2.1
'@push.rocks/smartfile':
specifier: ^11.0.21
version: 11.0.21
'@push.rocks/smartjson': '@push.rocks/smartjson':
specifier: ^5.0.20 specifier: ^5.0.20
version: 5.0.20 version: 5.0.20
'@push.rocks/smartmongo': '@push.rocks/smartmongo':
specifier: ^2.0.10 specifier: ^2.0.10
version: 2.0.10(@aws-sdk/client-sso-oidc@3.682.0) 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': '@push.rocks/smartpromise':
specifier: ^4.0.4 specifier: ^4.0.4
version: 4.0.4 version: 4.0.4
'@push.rocks/smartrequest':
specifier: ^2.0.23
version: 2.0.23
'@push.rocks/smarts3': '@push.rocks/smarts3':
specifier: ^2.2.5 specifier: ^2.2.5
version: 2.2.5 version: 2.2.5
@ -108,7 +117,7 @@ packages:
'@push.rocks/smartopen': 2.0.0 '@push.rocks/smartopen': 2.0.0
'@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4 '@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/smartrx': 3.0.7
'@push.rocks/smartsitemap': 2.0.3 '@push.rocks/smartsitemap': 2.0.3
'@push.rocks/smartstream': 3.2.4 '@push.rocks/smartstream': 3.2.4
@ -1733,7 +1742,7 @@ packages:
'@push.rocks/smartfile': 10.0.41 '@push.rocks/smartfile': 10.0.41
'@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4 '@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/smartrx': 3.0.7
'@push.rocks/smartstream': 2.0.8 '@push.rocks/smartstream': 2.0.8
'@push.rocks/smartunique': 3.0.9 '@push.rocks/smartunique': 3.0.9
@ -1903,7 +1912,7 @@ packages:
'@push.rocks/smartmime': 1.0.6 '@push.rocks/smartmime': 1.0.6
'@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4 '@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartrequest': 2.0.22 '@push.rocks/smartrequest': 2.0.23
'@push.rocks/smartstream': 2.0.8 '@push.rocks/smartstream': 2.0.8
'@types/fs-extra': 11.0.4 '@types/fs-extra': 11.0.4
'@types/glob': 8.1.0 '@types/glob': 8.1.0
@ -1924,7 +1933,7 @@ packages:
'@push.rocks/smartmime': 2.0.2 '@push.rocks/smartmime': 2.0.2
'@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4 '@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartrequest': 2.0.22 '@push.rocks/smartrequest': 2.0.23
'@push.rocks/smartstream': 3.2.4 '@push.rocks/smartstream': 3.2.4
'@types/fs-extra': 11.0.4 '@types/fs-extra': 11.0.4
'@types/glob': 8.1.0 '@types/glob': 8.1.0
@ -1937,7 +1946,7 @@ packages:
resolution: {integrity: sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==} resolution: {integrity: sha512-J23q84f1O+TwFGmd4lrO9XLHUh2DaLXo9PN/9VmTWYzTkQDv5JehmifXVI0esophXcCIfbdIu6hbt7/aHlDF4A==}
dependencies: dependencies:
'@push.rocks/smartpromise': 4.0.4 '@push.rocks/smartpromise': 4.0.4
'@push.rocks/smartrequest': 2.0.22 '@push.rocks/smartrequest': 2.0.23
/@push.rocks/smarthash@3.0.4: /@push.rocks/smarthash@3.0.4:
resolution: {integrity: sha512-HJ/fSx41jm0CvSaqMLa6b2nuNK5rHAqAeAq3dAB7Sq9BCPm2M0J5ZVDTzEAH8pS91XYniUiwuE0jwPERNn9hmw==} resolution: {integrity: sha512-HJ/fSx41jm0CvSaqMLa6b2nuNK5rHAqAeAq3dAB7Sq9BCPm2M0J5ZVDTzEAH8pS91XYniUiwuE0jwPERNn9hmw==}
@ -2063,7 +2072,7 @@ packages:
'@push.rocks/smartfile': 10.0.41 '@push.rocks/smartfile': 10.0.41
'@push.rocks/smartpath': 5.0.18 '@push.rocks/smartpath': 5.0.18
'@push.rocks/smartpromise': 4.0.4 '@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/smarttime': 4.0.8
'@push.rocks/smartversion': 3.0.5 '@push.rocks/smartversion': 3.0.5
package-json: 8.1.1 package-json: 8.1.1
@ -2137,8 +2146,8 @@ packages:
- utf-8-validate - utf-8-validate
dev: true dev: true
/@push.rocks/smartrequest@2.0.22: /@push.rocks/smartrequest@2.0.23:
resolution: {integrity: sha512-EfgmdEsLtDJ8aNOLOh59ca1NMsiiFz54aoHRigQFQ0cuoUs6phxejIY2FdMoPFn68ubTpkztdL2P4L1/cRYyHg==} resolution: {integrity: sha512-y+gtOwXFpmPL+mIQblYPdFuHufxHi5lMV0LKm5bPYgGdMq3/+QlnEqNEAumeMHjvXgxur7x30QiHSwpJGK5g9w==}
dependencies: dependencies:
'@push.rocks/smartpromise': 4.0.4 '@push.rocks/smartpromise': 4.0.4
'@push.rocks/smarturl': 3.1.0 '@push.rocks/smarturl': 3.1.0

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/tapbundle', 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.' description: 'A test automation library bundling utilities and tools for TAP (Test Anything Protocol) based testing, specifically tailored for tapbuffer.'
} }

View File

@ -1,7 +1,9 @@
import { TestFileProvider } from './classes.testfileprovider.js';
import * as plugins from './plugins.js'; import * as plugins from './plugins.js';
class TapNodeTools { class TapNodeTools {
private smartshellInstance: plugins.smartshell.Smartshell; private smartshellInstance: plugins.smartshell.Smartshell;
public testFileProvider = new TestFileProvider();
constructor() {} constructor() {}

View 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
View 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/');

View File

@ -1,12 +1,16 @@
// node native // node native
import * as crypto from 'crypto'; import * as crypto from 'crypto';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path';
export { crypto,fs }; export { crypto,fs, path, };
// @push.rocks scope // @push.rocks scope
import * as qenv from '@push.rocks/qenv'; import * as qenv from '@push.rocks/qenv';
import * as smartcrypto from '@push.rocks/smartcrypto'; 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'; import * as smartshell from '@push.rocks/smartshell';
export { qenv, smartcrypto, smartshell }; export { qenv, smartcrypto, smartfile, smartpath, smartrequest, smartshell, };