@lodestar/spec-test-util 1.30.0-dev.d92238fd84 → 1.30.0-dev.fa898bb319
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/downloadTests.js +13 -20
- package/lib/downloadTests.js.map +1 -1
- package/package.json +4 -3
package/lib/downloadTests.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
1
|
import fs from "node:fs";
|
|
3
2
|
import path from "node:path";
|
|
4
|
-
import
|
|
3
|
+
import stream from "node:stream";
|
|
5
4
|
import { promisify } from "node:util";
|
|
6
|
-
import {
|
|
5
|
+
import { retry } from "@lodestar/utils";
|
|
6
|
+
import axios from "axios";
|
|
7
7
|
import { rimraf } from "rimraf";
|
|
8
|
+
import { x as extractTar } from "tar";
|
|
8
9
|
export const defaultSpecTestsRepoUrl = "https://github.com/ethereum/consensus-spec-tests";
|
|
9
10
|
const logEmpty = () => { };
|
|
10
11
|
/**
|
|
@@ -33,26 +34,18 @@ export async function downloadGenericSpecTests({ specVersion, specTestsRepoUrl,
|
|
|
33
34
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
34
35
|
await Promise.all(testsToDownload.map(async (test) => {
|
|
35
36
|
const url = `${specTestsRepoUrl ?? defaultSpecTestsRepoUrl}/releases/download/${specVersion}/${test}.tar.gz`;
|
|
36
|
-
const tarball = path.join(outputDir, `${test}.tar.gz`);
|
|
37
37
|
await retry(async () => {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const totalSize = res.headers.get("content-length");
|
|
38
|
+
const { data, headers } = await axios({
|
|
39
|
+
method: "get",
|
|
40
|
+
url,
|
|
41
|
+
responseType: "stream",
|
|
42
|
+
timeout: 30 * 60 * 1000,
|
|
43
|
+
});
|
|
44
|
+
const totalSize = headers["content-length"];
|
|
46
45
|
log(`Downloading ${url} - ${totalSize} bytes`);
|
|
47
|
-
// stream download to local .tar.gz file
|
|
48
|
-
await pipeline(res.body, fs.createWriteStream(tarball));
|
|
49
|
-
log(`Downloaded ${url} - ${fs.statSync(tarball).size} bytes`);
|
|
50
46
|
// extract tar into output directory
|
|
51
|
-
await promisify(
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
log(`Extracted ${tarball} to ${outputDir}`);
|
|
55
|
-
fs.unlinkSync(tarball);
|
|
47
|
+
await promisify(stream.pipeline)(data, extractTar({ cwd: outputDir }));
|
|
48
|
+
log(`Downloaded ${url}`);
|
|
56
49
|
}, {
|
|
57
50
|
retries: 3,
|
|
58
51
|
onRetry: (e, attempt) => {
|
package/lib/downloadTests.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadTests.js","sourceRoot":"","sources":["../src/downloadTests.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"downloadTests.js","sourceRoot":"","sources":["../src/downloadTests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,CAAC,IAAI,UAAU,EAAC,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,uBAAuB,GAAG,kDAAkD,CAAC;AAE1F,MAAM,QAAQ,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAkBhC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAA0B,EAAE,MAA6B,QAAQ;IACnG,MAAM,wBAAwB,CAAC,IAAI,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;gBACtB,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;aACxB,CAAC,CAAC;YAEH,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAW,CAAC;YACtD,GAAG,CAAC,eAAe,GAAG,MAAM,SAAS,QAAQ,CAAC,CAAC;YAE/C,oCAAoC;YACpC,MAAM,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,EAAC,GAAG,EAAE,SAAS,EAAC,CAAC,CAAC,CAAC;YAErE,GAAG,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;QAC5B,CAAC,EACD;YACE,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE;gBACtB,GAAG,CAAC,oBAAoB,OAAO,QAAQ,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACrE,CAAC;SACF,CACF,CAAC;QAEF,eAAe;IACjB,CAAC,CAAC,CACH,CAAC;IAEF,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodestar/spec-test-util",
|
|
3
|
-
"version": "1.30.0-dev.
|
|
3
|
+
"version": "1.30.0-dev.fa898bb319",
|
|
4
4
|
"description": "Spec test suite generator from yaml test files",
|
|
5
5
|
"author": "ChainSafe Systems",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"blockchain"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@lodestar/utils": "1.30.0-dev.
|
|
65
|
+
"@lodestar/utils": "1.30.0-dev.fa898bb319",
|
|
66
|
+
"axios": "^1.3.4",
|
|
66
67
|
"rimraf": "^4.4.1",
|
|
67
68
|
"snappyjs": "^0.7.0",
|
|
68
69
|
"tar": "^6.1.13",
|
|
@@ -74,5 +75,5 @@
|
|
|
74
75
|
"peerDependencies": {
|
|
75
76
|
"vitest": "^3.0.6"
|
|
76
77
|
},
|
|
77
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "9bd944add3247a4c2d2125c9b542d391468a2ad8"
|
|
78
79
|
}
|