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): combine 3 tests into connector-fabric-baseline #3520

Conversation

petermetz
Copy link
Member

@petermetz petermetz commented Sep 5, 2024

  1. This is making the test case harder to read but shaves off easily
    10 to 15 minutes from one of our slowest CI jobs which can take up to an
    hour to run when the GitHub runners are feeling lazy.
  2. That above is my only justification for it. The test cases I'm consolidating
    are relatively stable at this point (took us years to get here but now they
    are passing with a high ratio and the false negatives have pretty much
    disappeared).
  3. We are downloading and launching the fabirc AIO ledger 10+ times which
    is very resource intensive and this could help make a dent in it.

Running this test right now looks like this on my machine:

PASS packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/
integration/fabric-v2-2-x/connector-fabric-baseline.test.ts (277.062 s, 638 MB heap size)

PluginLedgerConnectorFabric
✓ getBlockV1() -Get first block by it's number - decoded. (1216 ms)
✓ getBlockV1() - Get first block by it's number - encoded. (1084 ms)
✓ getBlockV1() - Get a block by transactionId it contains (4534 ms)
✓ getBlockV1() - Get a block by transactionId it contains - cacti transactions (4535 ms)
✓ getBlockV1() - Get a block by transactionId it contains - cacti full block (4559 ms)
✓ getBlockV1() - Get block by it's hash. (6727 ms)
✓ getBlockV1() - Reading block with invalid number returns an error. (1 ms)
✓ GetChainInfoV1() - Get test ledger chain info. (2134 ms)
✓ deployContractV1() - deploys Fabric 2.x contract from go source (38351 ms)
✓ deployContractV1() - deploys contract and performs transactions (40840 ms)

Test Suites: 1 passed, 1 total
Tests: 10 passed, 10 total
Snapshots: 0 total
Time: 277.117 s

Signed-off-by: Peter Somogyvari peter.somogyvari@accenture.com

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

Copy link
Contributor

@jagpreetsinghsasan jagpreetsinghsasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with small nitpick.

BTW When I was creating iroha2 tests I was thinking about using common ledger setup for all the tests, I even moved env setup to separate class for that reason (see https://github.com/hyperledger/cacti/tree/main/packages/cactus-plugin-ledger-connector-iroha2/src/test/typescript). In the end I did not do that (to adhere to general principle that tests should not depend on each other too much and because iroha starts really quickly), but maybe this could be considered for fabric connector where the ledger takes a looong time to start up.

@petermetz
Copy link
Member Author

LGTM with small nitpick.

BTW When I was creating iroha2 tests I was thinking about using common ledger setup for all the tests, I even moved env setup to separate class for that reason (see https://github.com/hyperledger/cacti/tree/main/packages/cactus-plugin-ledger-connector-iroha2/src/test/typescript). In the end I did not do that (to adhere to general principle that tests should not depend on each other too much and because iroha starts really quickly), but maybe this could be considered for fabric connector where the ledger takes a looong time to start up.

@outSH Agreed, 100%. Now that I know that there's some support for the idea I'll consolidate a few more tests into one! Stay tuned for an upcoming PR :-)

@petermetz petermetz force-pushed the test-connector-fabric-increase-ci-performance-by-consolidating-into-deploy-lock-asset branch from 043a8b6 to c664438 Compare September 11, 2024 16:26
Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petermetz LGTM, thanks! Please remember to update the commit/PR title to include the new test name, apporving to speed this up :)

@petermetz petermetz changed the title test(connector-fabric): consolidate 3 tests into deploy-lock-asset.test test(connector-fabric): combine 3 tests into connector-fabric-baseline Sep 16, 2024
@petermetz petermetz force-pushed the test-connector-fabric-increase-ci-performance-by-consolidating-into-deploy-lock-asset branch from c664438 to 43209df Compare September 16, 2024 02:56
@petermetz
Copy link
Member Author

@petermetz LGTM, thanks! Please remember to update the commit/PR title to include the new test name, apporving to speed this up :)

@outSH Done and done, thank you for catching that and also much appreciated on the pre-approval :-)

1. This is making the test case harder to read but shaves off easily
10 to 15 minutes from one of our slowest CI jobs which can take up to an
hour to run when the GitHub runners are feeling lazy.
2. That above is my only justification for it. The test cases I'm consolidating
are relatively stable at this point (took us years to get here but now they
are passing with a high ratio and the false negatives have pretty much
disappeared).
3. We are downloading and launching the fabirc AIO ledger 10+ times which
is very resource intensive and this could help make a dent in it.

Running this test right now looks like this on my machine:

 PASS  packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/
 integration/fabric-v2-2-x/connector-fabric-baseline.test.ts (277.062 s, 638 MB heap size)

  PluginLedgerConnectorFabric
    ✓ getBlockV1() -Get first block by it's number - decoded. (1216 ms)
    ✓ getBlockV1() - Get first block by it's number - encoded. (1084 ms)
    ✓ getBlockV1() - Get a block by transactionId it contains (4534 ms)
    ✓ getBlockV1() - Get a block by transactionId it contains - cacti transactions (4535 ms)
    ✓ getBlockV1() - Get a block by transactionId it contains - cacti full block (4559 ms)
    ✓ getBlockV1() - Get block by it's hash. (6727 ms)
    ✓ getBlockV1() - Reading block with invalid number returns an error. (1 ms)
    ✓ GetChainInfoV1() - Get test ledger chain info. (2134 ms)
    ✓ deployContractV1() - deploys Fabric 2.x contract from go source (38351 ms)
    ✓ deployContractV1() - deploys contract and performs transactions (40840 ms)

Test Suites: 1 passed, 1 total
Tests:       10 passed, 10 total
Snapshots:   0 total
Time:        277.117 s

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz force-pushed the test-connector-fabric-increase-ci-performance-by-consolidating-into-deploy-lock-asset branch from 43209df to d36c9ae Compare September 16, 2024 03:57
@petermetz petermetz merged commit 3172fc6 into hyperledger:main Sep 16, 2024
148 checks passed
@petermetz petermetz deleted the test-connector-fabric-increase-ci-performance-by-consolidating-into-deploy-lock-asset branch September 16, 2024 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants