Page MenuHomePhabricator

[chronik-client] Use `ecash-lib` in integration tests
Changes PlannedPublic

Authored by tobias_ruck on Apr 29 2024, 23:37.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

chronik-client-integration-tests is notorious for breaking (see D16077).

One way to remy this is to move the test logic from the python setup scripts into the functional tests themselves, without having to do any IPC within the test itself.

To do this, we import the new ecash-lib into the chronik-client integration tests (here, only chronik_info.ts), and interact only through chronik.

Similar to D16063, we split the type checking and the build step of TypeScript, but here we do it to resolve the circular dependency between chronik-client's tests and ecash-lib, which have to be built in this order to work: chronik-client (build:lib), then ecash-lib.

Mocha gives us Unknown file extension ".ts" for unclear reasons after this change; it is fixed by using the tsx package, like we've done for ecash-lib's tests already previously.

Test Plan
  1. build ecash-lib-wasm
  2. build chronik-client: npm run build:lib
  3. build ecash-lib: npm run build
  4. test chronik-client: BUILD_DIR=../../build npm run integration-tests

Event Timeline

Tail of the build log:

Test does not depend on mock-chronik-client, skipping mock-chronik-client dependencies...
Test does not depend on ecash-lib-wasm, skipping
Test does not depend on chronik-client
/work/modules/chronik-client /work/abc-ci-builds/chronik-client-tests

> chronik-client@0.26.2 prepublish
> npm run build


> chronik-client@0.26.2 build
> tsc && npm run build:lib

test/integration/chronik_info.ts(7,28): error TS2307: Cannot find module 'ecash-lib/dist/test/testRunner' or its corresponding type declarations.
test/integration/chronik_info.ts(8,31): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
npm ERR! code 2
npm ERR! path /work/modules/chronik-client
npm ERR! command failed
npm ERR! command sh -c npm run build

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-29T23_53_30_163Z-debug-0.log
Build chronik-client-tests failed with exit code 2

Tail of the build log:

  Downloaded wasm-bindgen v0.2.92
  Downloaded syn v2.0.58
  Downloaded ripemd v0.1.3
  Downloaded typenum v1.17.0
  Downloaded thiserror-impl v1.0.58
  Downloaded thiserror v1.0.58
  Downloaded sha2 v0.10.8
  Downloaded crypto-common v0.1.6
  Downloaded cc v1.0.92
  Downloaded bumpalo v3.16.0
  Downloaded proc-macro2 v1.0.79
  Downloaded block-buffer v0.10.4
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.4
   Compiling typenum v1.17.0
   Compiling wasm-bindgen-shared v0.2.92
   Compiling once_cell v1.19.0
   Compiling cc v1.0.92
   Compiling bumpalo v3.16.0
   Compiling log v0.4.21
   Compiling cfg-if v1.0.0
   Compiling wasm-bindgen v0.2.92
   Compiling thiserror v1.0.58
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.58
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling ripemd v0.1.3
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.58
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 5.72s
Test depends on chronik-client. Building TypeScript...
/work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests

> chronik-client@0.26.2 prepublish
> npm run build


> chronik-client@0.26.2 build
> tsc && npm run build:lib

test/integration/chronik_info.ts(7,28): error TS2307: Cannot find module 'ecash-lib/dist/test/testRunner' or its corresponding type declarations.
test/integration/chronik_info.ts(8,31): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
npm ERR! code 2
npm ERR! path /work/modules/chronik-client
npm ERR! command failed
npm ERR! command sh -c npm run build

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-29T23_55_14_417Z-debug-0.log
Build ecash-lib-tests failed with exit code 2

Tail of the build log:

Test depends on ecash-lib-wasm. Building WebAssembly...
/work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-integration-tests
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
 Downloading crates ...
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded bumpalo v3.16.0
  Downloaded wasm-bindgen v0.2.92
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.4
   Compiling typenum v1.17.0
   Compiling wasm-bindgen-shared v0.2.92
   Compiling log v0.4.21
   Compiling bumpalo v3.16.0
   Compiling once_cell v1.19.0
   Compiling cc v1.0.92
   Compiling thiserror v1.0.58
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.58
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling ripemd v0.1.3
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.58
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 4.54s
Test depends on chronik-client. Building TypeScript...
/work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-integration-tests

> chronik-client@0.26.2 prepublish
> npm run build


> chronik-client@0.26.2 build
> tsc && npm run build:lib

test/integration/chronik_info.ts(7,28): error TS2307: Cannot find module 'ecash-lib/dist/test/testRunner' or its corresponding type declarations.
test/integration/chronik_info.ts(8,31): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
npm ERR! code 2
npm ERR! path /work/modules/chronik-client
npm ERR! command failed
npm ERR! command sh -c npm run build

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-30T00_00_29_422Z-debug-0.log
Build ecash-lib-integration-tests failed with exit code 2

Tail of the build log:

Test depends on ecash-lib-wasm. Building WebAssembly...
/work/modules/ecash-lib-wasm /work/abc-ci-builds/chronik-client-integration-tests
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
 Downloading crates ...
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded bumpalo v3.16.0
  Downloaded wasm-bindgen v0.2.92
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.4
   Compiling typenum v1.17.0
   Compiling wasm-bindgen-shared v0.2.92
   Compiling cc v1.0.92
   Compiling once_cell v1.19.0
   Compiling log v0.4.21
   Compiling bumpalo v3.16.0
   Compiling thiserror v1.0.58
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.58
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.58
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 4.41s
Test depends on chronik-client. Building TypeScript...
/work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/chronik-client-integration-tests

> chronik-client@0.26.2 prepublish
> npm run build


> chronik-client@0.26.2 build
> tsc && npm run build:lib

test/integration/chronik_info.ts(7,28): error TS2307: Cannot find module 'ecash-lib/dist/test/testRunner' or its corresponding type declarations.
test/integration/chronik_info.ts(8,31): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
npm ERR! code 2
npm ERR! path /work/modules/chronik-client
npm ERR! command failed
npm ERR! command sh -c npm run build

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-30T00_01_53_888Z-debug-0.log
Build chronik-client-integration-tests failed with exit code 2

update chronik-client prepublish

Failed tests logs:

====== ALP: "before all" hook for "TxBuilder P2PKH ALP".ALP "before all" hook for "TxBuilder P2PKH ALP" ======
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts Did you mean to import "file:///work/modules/chronik-client/index.ts"?
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts
Did you mean to import "file:///work/modules/chronik-client/index.ts"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:841:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at d (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:34)
    at O (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:1162)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
====== ALP: "after all" hook for "TxBuilder P2PKH ALP".ALP "after all" hook for "TxBuilder P2PKH ALP" ======
TypeError: Cannot read properties of undefined (reading 'stop')
    at Context.<anonymous> (tests/alp.test.ts:52:16)
    at process.processImmediate (node:internal/timers:478:21)
====== TxBuilder: "before all" hook for "TxBuilder P2PKH Wallet".TxBuilder "before all" hook for "TxBuilder P2PKH Wallet" ======
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts Did you mean to import "file:///work/modules/chronik-client/index.ts"?
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts
Did you mean to import "file:///work/modules/chronik-client/index.ts"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:841:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at d (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:34)
    at O (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:1162)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
====== TxBuilder: "after all" hook for "TxBuilder leftover failure".TxBuilder "after all" hook for "TxBuilder leftover failure" ======
TypeError: Cannot read properties of undefined (reading 'stop')
    at Context.<anonymous> (tests/txBuilder.test.ts:62:16)
    at process.processImmediate (node:internal/timers:478:21)

Each failure log is accessible here:
ALP: "before all" hook for "TxBuilder P2PKH ALP".ALP "before all" hook for "TxBuilder P2PKH ALP"
ALP: "after all" hook for "TxBuilder P2PKH ALP".ALP "after all" hook for "TxBuilder P2PKH ALP"
TxBuilder: "before all" hook for "TxBuilder P2PKH Wallet".TxBuilder "before all" hook for "TxBuilder P2PKH Wallet"
TxBuilder: "after all" hook for "TxBuilder leftover failure".TxBuilder "after all" hook for "TxBuilder leftover failure"

Failed tests logs:

====== /chronik-info: "before all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "before all" hook for "gives us the chronik info and throws expected error on bad server connection" ======
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/dist/test/testRunner.js Did you mean to import "file:///work/modules/chronik-client/index.ts"?
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/dist/test/testRunner.js
Did you mean to import "file:///work/modules/chronik-client/index.ts"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:841:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at d (file:///work/modules/chronik-client/node_modules/tsx/dist/esm/index.mjs:5:34)
    at F (file:///work/modules/chronik-client/node_modules/tsx/dist/esm/index.mjs:5:1169)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
====== /chronik-info: "after all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "after all" hook for "gives us the chronik info and throws expected error on bad server connection" ======
TypeError: Cannot read properties of undefined (reading 'stop')
    at Context.<anonymous> (test/integration/chronik_info.ts:23:16)
    at process.processImmediate (node:internal/timers:478:21)

Each failure log is accessible here:
/chronik-info: "before all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "before all" hook for "gives us the chronik info and throws expected error on bad server connection"
/chronik-info: "after all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "after all" hook for "gives us the chronik info and throws expected error on bad server connection"

Failed tests logs:

====== ALP: "before all" hook for "TxBuilder P2PKH ALP".ALP "before all" hook for "TxBuilder P2PKH ALP" ======
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts Did you mean to import "file:///work/modules/chronik-client/index.ts"?
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts
Did you mean to import "file:///work/modules/chronik-client/index.ts"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:841:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at d (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:34)
    at O (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:1162)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
====== ALP: "after all" hook for "TxBuilder P2PKH ALP".ALP "after all" hook for "TxBuilder P2PKH ALP" ======
TypeError: Cannot read properties of undefined (reading 'stop')
    at Context.<anonymous> (tests/alp.test.ts:52:16)
    at process.processImmediate (node:internal/timers:478:21)
====== TxBuilder: "before all" hook for "TxBuilder P2PKH Wallet".TxBuilder "before all" hook for "TxBuilder P2PKH Wallet" ======
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts Did you mean to import "file:///work/modules/chronik-client/index.ts"?
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/src/test/testRunner.ts
Did you mean to import "file:///work/modules/chronik-client/index.ts"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:841:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at d (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:34)
    at O (file:///work/modules/ecash-lib/node_modules/tsx/dist/esm/index.mjs:5:1162)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
====== TxBuilder: "after all" hook for "TxBuilder leftover failure".TxBuilder "after all" hook for "TxBuilder leftover failure" ======
TypeError: Cannot read properties of undefined (reading 'stop')
    at Context.<anonymous> (tests/txBuilder.test.ts:62:16)
    at process.processImmediate (node:internal/timers:478:21)

Each failure log is accessible here:
ALP: "before all" hook for "TxBuilder P2PKH ALP".ALP "before all" hook for "TxBuilder P2PKH ALP"
ALP: "after all" hook for "TxBuilder P2PKH ALP".ALP "after all" hook for "TxBuilder P2PKH ALP"
TxBuilder: "before all" hook for "TxBuilder P2PKH Wallet".TxBuilder "before all" hook for "TxBuilder P2PKH Wallet"
TxBuilder: "after all" hook for "TxBuilder leftover failure".TxBuilder "after all" hook for "TxBuilder leftover failure"

Failed tests logs:

====== /chronik-info: "before all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "before all" hook for "gives us the chronik info and throws expected error on bad server connection" ======
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/dist/test/testRunner.js Did you mean to import "file:///work/modules/chronik-client/index.ts"?
Error: Cannot find package '/work/modules/ecash-lib/node_modules/chronik-client/package.json' imported from /work/modules/ecash-lib/dist/test/testRunner.js
Did you mean to import "file:///work/modules/chronik-client/index.ts"?
    at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
    at packageResolve (node:internal/modules/esm/resolve:841:14)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at d (file:///work/modules/chronik-client/node_modules/tsx/dist/esm/index.mjs:5:34)
    at F (file:///work/modules/chronik-client/node_modules/tsx/dist/esm/index.mjs:5:1169)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
====== /chronik-info: "after all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "after all" hook for "gives us the chronik info and throws expected error on bad server connection" ======
TypeError: Cannot read properties of undefined (reading 'stop')
    at Context.<anonymous> (test/integration/chronik_info.ts:23:16)
    at process.processImmediate (node:internal/timers:478:21)

Each failure log is accessible here:
/chronik-info: "before all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "before all" hook for "gives us the chronik info and throws expected error on bad server connection"
/chronik-info: "after all" hook for "gives us the chronik info and throws expected error on bad server connection"./chronik-info "after all" hook for "gives us the chronik info and throws expected error on bad server connection"

don't use deferred import for chronik-client in testRunner.ts

use direct import in testRunner consistently, revert tsx change in mocha

Tail of the build log:

> ecash-lib@0.1.0 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

/work/modules/chronik-client /work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/chronik-client-integration-tests

> chronik-client@0.26.2 prepublish
> npm run build:lib


> chronik-client@0.26.2 build:lib
> tsc -p ./tsconfig.build.json


added 271 packages, and audited 273 packages in 4s

49 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> chronik-client@0.26.2 integration-tests
> mocha -j1 -r ts-node/register test/integration/*.ts --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/chronik-client-integration-tests-junit.xml --reporter-options testsuitesTitle=Chronik Client Integration Tests --reporter-options rootSuiteTitle=Chronik Client


TypeError: Unknown file extension ".ts" for /work/modules/chronik-client/test/integration/chronik_info.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
    at defaultLoad (node:internal/modules/esm/load:143:22)
    at async ModuleLoader.load (node:internal/modules/esm/loader:403:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:45)
    at async link (node:internal/modules/esm/module_job:78:21)
-----------------------|---------|----------|---------|---------|-----------------------------------
File                   | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                 
-----------------------|---------|----------|---------|---------|-----------------------------------
All files              |    5.25 |     0.63 |    1.49 |    5.22 |                                   
 chronik-client        |     100 |      100 |     100 |     100 |                                   
  index.ts             |     100 |      100 |     100 |     100 |                                   
 chronik-client/proto  |    4.81 |     0.68 |    1.86 |    4.82 |                                   
  chronik.ts           |    5.44 |     0.84 |    1.81 |    5.42 | ...,3978-3985,3990-4027,4031-4036 
  chronikNode.ts       |    4.33 |     0.55 |     1.9 |    4.36 | ...,4882-4921,4929-5033,5037-5042 
 chronik-client/src    |    7.58 |        0 |       0 |    7.38 |                                   
  ChronikClient.ts     |    4.24 |        0 |       0 |    4.29 | 33-163,178-222,290-692            
  ChronikClientNode.ts |    6.34 |        0 |       0 |    6.34 | 33-183,198-276,289-361,428-1004   
  failoverProxy.ts     |    5.71 |        0 |       0 |    5.88 | 34-317                            
  hex.ts               |   31.57 |        0 |       0 |   33.33 | 33-37,41-45,49-62,66-68           
  validation.ts        |      15 |        0 |       0 |   10.52 | 12-47                             
-----------------------|---------|----------|---------|---------|-----------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='215']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='4095']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='28']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='4422']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='11']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='737']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='212']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='4056']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/chronik-client-integration-tests-junit.xml': No such file or directory
Build chronik-client-integration-tests failed with exit code 1

Tail of the build log:

> ecash-lib@0.1.0 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

/work/modules/chronik-client /work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/chronik-client-integration-tests

> chronik-client@0.26.2 prepublish
> npm run build:lib


> chronik-client@0.26.2 build:lib
> tsc -p ./tsconfig.build.json


added 271 packages, and audited 273 packages in 5s

49 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> chronik-client@0.26.2 integration-tests
> mocha -j1 -r ts-node/register test/integration/*.ts --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/chronik-client-integration-tests-junit.xml --reporter-options testsuitesTitle=Chronik Client Integration Tests --reporter-options rootSuiteTitle=Chronik Client


TypeError: Unknown file extension ".ts" for /work/modules/chronik-client/test/integration/chronik_info.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
    at defaultLoad (node:internal/modules/esm/load:143:22)
    at async ModuleLoader.load (node:internal/modules/esm/loader:403:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:45)
    at async link (node:internal/modules/esm/module_job:78:21)
-----------------------|---------|----------|---------|---------|-----------------------------------
File                   | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                 
-----------------------|---------|----------|---------|---------|-----------------------------------
All files              |    5.25 |     0.63 |    1.49 |    5.22 |                                   
 chronik-client        |     100 |      100 |     100 |     100 |                                   
  index.ts             |     100 |      100 |     100 |     100 |                                   
 chronik-client/proto  |    4.81 |     0.68 |    1.86 |    4.82 |                                   
  chronik.ts           |    5.44 |     0.84 |    1.81 |    5.42 | ...,3978-3985,3990-4027,4031-4036 
  chronikNode.ts       |    4.33 |     0.55 |     1.9 |    4.36 | ...,4882-4921,4929-5033,5037-5042 
 chronik-client/src    |    7.58 |        0 |       0 |    7.38 |                                   
  ChronikClient.ts     |    4.24 |        0 |       0 |    4.29 | 33-163,178-222,290-692            
  ChronikClientNode.ts |    6.34 |        0 |       0 |    6.34 | 33-183,198-276,289-361,428-1004   
  failoverProxy.ts     |    5.71 |        0 |       0 |    5.88 | 34-317                            
  hex.ts               |   31.57 |        0 |       0 |   33.33 | 33-37,41-45,49-62,66-68           
  validation.ts        |      15 |        0 |       0 |   10.52 | 12-47                             
-----------------------|---------|----------|---------|---------|-----------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='215']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='4095']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='28']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='4422']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='11']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='737']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='212']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='4056']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/chronik-client-integration-tests-junit.xml': No such file or directory
Build chronik-client-integration-tests failed with exit code 1

switch back to tsx in mocha again

tobias_ruck edited the test plan for this revision. (Show Details)

Tail of the build log:


added 276 packages, and audited 278 packages in 6s

51 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Test depends on ecash-lib. Building TypeScript...
/work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/chronik-client-integration-tests

added 362 packages, and audited 364 packages in 2s

60 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> ecash-lib@0.1.0 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

/work/modules/chronik-client /work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/chronik-client-integration-tests

> chronik-client@0.26.2 prepublish
> npm run build:lib


> chronik-client@0.26.2 build:lib
> tsc -p ./tsconfig.build.json


added 276 packages, and audited 278 packages in 4s

51 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> chronik-client@0.26.2 integration-tests
> mocha -j1 -r --import=tsx test/integration/*.ts --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/chronik-client-integration-tests-junit.xml --reporter-options testsuitesTitle=Chronik Client Integration Tests --reporter-options rootSuiteTitle=Chronik Client

Error: Not enough arguments following: r
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='0']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/chronik-client-integration-tests-junit.xml': No such file or directory
Build chronik-client-integration-tests failed with exit code 1
bytesofman requested changes to this revision.May 1 2024, 12:00

One way to remy this is to move the test logic from the python setup scripts into the functional tests themselves, without having to do any IPC within the test itself.

It's not clear to me how this would work for more complicated tests. chronik_info does not have multiple steps and states to test. Most of the other functional tests do, e.g. script_endpoints.ts and chronik-client_script_endpoints.py.

Need to demonstrate this approach would also work for more complicated tests.

modules/chronik-client/package.json
29 ↗(On Diff #47518)

separate issue but I need to find a way to support these local installs in CI across the entire monorepo.

T3548

We've addressed it in tests with the DEPENDS args. However this will break automated deployments as these run from the Dockerfile at the modules/chronik-client level which does not have access to other directories.

This revision now requires changes to proceed.May 1 2024, 12:00

Put this on hold until it's clear this is a good path forward