Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(connector-fabric): fix v2-2-x/deploy-cc-from-typescript-source.test.ts #2322

Closed
petermetz opened this issue Mar 15, 2023 · 0 comments · Fixed by #2323
Closed

test(connector-fabric): fix v2-2-x/deploy-cc-from-typescript-source.test.ts #2322

petermetz opened this issue Mar 15, 2023 · 0 comments · Fixed by #2323
Assignees
Labels
bug Something isn't working dependencies Pull requests that update a dependency file Fabric Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) Tests Anything related to tests be that automatic or manual, integration or unit, etc.

Comments

@petermetz
Copy link
Contributor

petermetz commented Mar 15, 2023

Reproduces on both the CI and locally on Ubuntu-20.04 as well.

Relevant log snippet:

    [2023-03-15T01:54:09.573Z] DEBUG (PluginLedgerConnectorFabric): ChainCode: Typescript build CMD: npm run build
    [2023-03-15T01:54:12.623Z] DEBUG (PluginLedgerConnectorFabric): ChainCode: Typescript build CMD Response: {
      code: 2,
      signal: null,
      stdout: '> [email protected] build /opt/gopath/src/basic-asset-transfer-2\r\n' +
        '> tsc\r\n' +
        '\r\n' +
        "\x1B[96mnode_modules/logform/index.d.ts\x1B[0m:\x1B[93m14\x1B[0m:\x1B[93m4\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS1023: \x1B[0mAn index signature parameter type must be either 'string' or 'number'.\r\n" +
        '\r\n' +
        '\x1B[7m14\x1B[0m   [key: string | symbol]: any;\r\n' +
        '\x1B[7m  \x1B[0m \x1B[91m   ~~~\x1B[0m\r\n' +
        '\r\n' +
        '\r\n' +
        'Found 1 error.\r\n' +
        '\r\n' +
        '\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m \x1B[0m\x1B[35mcode\x1B[0m ELIFECYCLE\r\n' +
        '\x1B[0m\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m \x1B[0m\x1B[35merrno\x1B[0m 2\r\n' +
        '\x1B[0m\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m\x1B[35m\x1B[0m [email protected] build: `tsc`\r\n' +
        '\x1B[0m\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m\x1B[35m\x1B[0m Exit status 2\r\n' +
        '\x1B[0m\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m\x1B[35m\x1B[0m \r\n' +
        '\x1B[0m\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m\x1B[35m\x1B[0m Failed at the [email protected] build script.\r\n' +
        '\x1B[0m\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m\x1B[35m\x1B[0m This is probably not a problem with npm. There is likely additional logging output above.\r\n' +
        '\x1B[0m\r\n' +
        '\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m\x1B[35m\x1B[0m A complete log of this run can be found in:\r\n' +
        '\x1B[0m\x1B[37;40mnpm\x1B[0m \x1B[0m\x1B[31;40mERR!\x1B[0m\x1B[35m\x1B[0m     /root/.npm/_logs/2023-03-15T01_54_12_605Z-debug.log\r\n' +
        '\x1B[0m',
      stderr: ''
    }
    not ok 3 Error: Request failed with status code 500
      ---
        operator: error
        at: bound (/home/peter/a/cactus/node_modules/tape-promise/node_modules/onetime/index.js:30:12)
        stack: |-
          Error: Request failed with status code 500
              at createError (/home/peter/a/cactus/node_modules/axios/lib/core/createError.js:16:15)
              at settle (/home/peter/a/cactus/node_modules/axios/lib/core/settle.js:17:12)
              at IncomingMessage.handleStreamEnd (/home/peter/a/cactus/node_modules/axios/lib/adapters/http.js:269:11)
              at IncomingMessage.emit (node:events:525:35)
              at IncomingMessage.emit (node:domain:489:12)
              at endReadableNT (node:internal/streams/readable:1359:12)
              at processTicksAndRejections (node:internal/process/task_queues:82:21)
      ...

Full CI crash log:
2023-03-14_cacti-connector-fabric-ci-crash.log

@petermetz petermetz added bug Something isn't working dependencies Pull requests that update a dependency file Fabric Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) Tests Anything related to tests be that automatic or manual, integration or unit, etc. labels Mar 15, 2023
@petermetz petermetz self-assigned this Mar 15, 2023
petermetz added a commit to petermetz/cacti that referenced this issue Mar 15, 2023
The test case [1] uses the "standard" basic-asset-transfer example for
verifying contract deployment functionality and in this instance, the
problem was traced back to the NodeJS flavor of the contract having
a transitive dependency (fabric-contract-api => winston => logform) which
was probably being auto-upgraded (due to our test fixture lacking a
package-lock.json or yarn.lock file) and leading to the typescript
compilation of the project failing because of updates that must've been
pushed into the index.d.ts file of the logform transitive dependency.

The fix applied here is to just disable the lib checking of the compiler
so that the typescript code of dependencies is not type-checked at all.

This would be a no-go if we were talking about the code of the Cacti
framework itself, but should be fine in a test fixture project which is
not used in production at all and instead only exists to support the
test execution.

Fixes hyperledger-cacti#2322

Signed-off-by: Peter Somogyvari <[email protected]>
petermetz referenced this issue in petermetz/cacti Mar 24, 2023
Telling the typescript compiler to skip the library code check so that
auto-updating dependencies don't break the test fixture chain code
compilation.

The root cause and the fix are equivalent as they were for:
https://github.com/hyperledger/cacti/issues/2322
https://github.com/hyperledger/cacti/pull/2323
Commit SHA: dfb7278

Fixes hyperledger-cacti#2341

Also sneaking in a .gitignore change with this: there is a VSCode
extension that stores local editing history of files in a .history/
sub-folder and that needs to be ignored in git otherwise it just keeps
popping up in the git index which is annoying sometimes.

Signed-off-by: Peter Somogyvari <[email protected]>
petermetz referenced this issue in petermetz/cacti Apr 4, 2023
Telling the typescript compiler to skip the library code check so that
auto-updating dependencies don't break the test fixture chain code
compilation.

The root cause and the fix are equivalent as they were for:
https://github.com/hyperledger/cacti/issues/2322
https://github.com/hyperledger/cacti/pull/2323
Commit SHA: dfb7278

Fixes hyperledger-cacti#2341

Also sneaking in a .gitignore change with this: there is a VSCode
extension that stores local editing history of files in a .history/
sub-folder and that needs to be ignored in git otherwise it just keeps
popping up in the git index which is annoying sometimes.

Signed-off-by: Peter Somogyvari <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file Fabric Flaky-Test-Automation Issues related to test stability (which is a long running issue that can never fully be solved) Tests Anything related to tests be that automatic or manual, integration or unit, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant